SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: * * in css

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2008
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    * * in css

    *{ margin: 0; padding: 0; }*

    I saw this piece of code in a css file.
    Can someone tell me what the double asterisks mean? I've never come across it before.

    Thanks.

    DS

  2. #2
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Presumably the asterix at the end of that rule will actually be applying to the beginning of the next one.

    So if you have...

    Code:
    *{ margin: 0; padding: 0; }*
    h1 {
      color: #C00;
    }
    ...it would be the same as...

    Code:
    *{ margin: 0; padding: 0; }
    * h1 {
      color: #C00;
    }
    It all depends on what the code that follows though as it could also be used as the star selector hack for IE6 so I'd need to see a little more code.

    If it's the same as my example above though, then it won't actually be doing anything so could be removed.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2008
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the quick reply - here is the complete CSS

    Code:
    
    *{ margin: 0; padding: 0; }*
    body { margin: 30px 0 0 0; background: #fff url(../images/bg.gif) repeat-x; font: .74em "Trebuchet MS", Arial, Sans-Serif; color: #444; }
    h1 { font-size: 3em; font-weight: normal; float: left; }
    h1 a { text-decoration: none; }
    h2 { font-size: 2em; color: #FFF2B3; font-weight: normal; margin: 0 0 .8em; }
    h3 { font-size: 1.5em; border-bottom: 1px solid #eee; margin: 0 0 .8em; }
    p  { margin: 0 0 2em 0; line-height: 1.8em; }
    em { border-bottom: 1px dotted #fff; cursor: pointer; }
    a { color: #9D2900; }
    a:hover { color: #A0000E; text-decoration: none; }
    img { border: 0; }
    label {margin-right: 6px;}
    	
    
    #bar { height: 5px; margin: px; padding: 0px; background: url(../images/bar.gif) repeat-x; }
    #bread {clear: both; font-size: larger; margin: 10px 0 0 0;}
     
    #header { width: 900px;  margin: 0 auto;}
    
    #menu  { float: right; padding: 6px 0 0 0; list-style: none; }
    #menu li { display: inline; }
    #menu a { display: block; float: left; margin-left: 30px; padding: 7px; text-decoration: none; font-size: 13px; color: #000000; }
    #menu a:hover { color: #000; border-bottom: 2px solid #ccc; }
    #menu .active a { border-bottom: 2px solid #C70012; color: #9D2900;}
     
    #teaser { clear: both;  background-image: url(../images/teaserbg.jpg); background-color: #fff; }
    
    
    
    #footer { clear: both; width: 900px; margin: 0 auto; padding: 15px; border-top: 1px solid #e0e0e0;  }	
    #footer .right { float: right; margin: 0 55px 0 0; }
    #footer a { color: #808080; font-weight: bold; }
    
    .box { float: left; padding: 0; width: 100%; color: #C7E3EE; }	
    .col { float: left; width: 276px; margin: 0 30px 16px 0; }
    .info { border: 1px solid #e0e0e0; background: #f4f4f4; padding: 7px; }
    .last { float: right; margin: 0; }
    .red { color: #9D2900; }
    .step { cursor: pointer; color: #FAFDDD; padding: 4px 0 0 11px; margin: 0 35px 0 0; font-size: 1.4em; float: left; text-align: center; background: url(../images/step.gif) no-repeat; height: 30px; }
    .step a { color: #fff; margin: 0 10px 0 0; }
    .wrap { width: 900px; margin: 0 auto; }

  4. #4
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In that scenario it won't do any harm but won't actually be doing anything either. It's essentially saying "style the body tag within ANY element" which of course it always is anyway (it's nested within the html tag).

    Personally I'd remove it from your code. It may only be there in the first place because someone has used /* to comment out a block of code and forgot to remove the comment completely.

    Hope that helps.

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2008
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll just kick it off.
    Thanks. As I say - it's nothing I've seen before so thought I'd ask.

    DS


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •