SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    Posts
    443
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    proper css semantics

    when creating a style sheet for nested div's, what is the proper way to code the css?

    example:
    Code:
    <div id="container">
    <div id="content">
    <div id="content-liner">
    <p></p>
    </div>
    </div>
    </div>
    Is this the proper way to code the css:
    Code:
    #container {
    }
    
    #container #content {
    }
    
    #container #content #content-liner {
    }
    
    #container #content #content-liner p {
    }
    or should it be:

    Code:
    #container {
    }
    
    #content {
    }
    
    #content-liner {
    }
    
    #content-liner p {
    }

  2. #2
    SitePoint Addict
    Join Date
    Sep 2001
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the 2nd thing. u only need to get more specific if necessary, otherwise you're just bloating your code, unless it makes it easier to understand for you.
    Steve Davis

  3. #3
    SitePoint Wizard drhowarddrfine's Avatar
    Join Date
    Aug 2005
    Posts
    3,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think all those divs already makes it bloated.

  4. #4
    SitePoint Addict
    Join Date
    Sep 2001
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it was probably just an example. if that was all the content, it would probably only need 1 div.
    Steve Davis


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
  •