Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: specifity

  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    specifity

    Is this css declaration ...

    PHP Code:
    div#firstDivie ul#unorderListlistOfFirstDivie li {
    height50px;

    the same as the one here under:

    PHP Code:
    ul#unorderListlistOfFirstDivie li {
    height50px;

    Is the first one on higher specifity ... ?

  • #2
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    Since your using ID's I would use the second one. There should only be one element per ID so those 2 do the same thing.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #3
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    	<head>
    		<title>66589</title>
    		<style type="text/css">
    			div#firstDivie ul#unorderListlistOfFirstDivie li
    			{
    				color:#f00;
    			}
    			ul#unorderListlistOfFirstDivie li
    			{
    				color:#0f0;
    			}
    		</style>
    	</head>
    	<body>
    		<div id="firstDivie">
    			<ul id="unorderListlistOfFirstDivie">
    				<li>
    					This text should show what selector has higher specifity.
    				</li>
    			</ul>
    		</div>
    	</body>
    </html>
    This shows the first has higher specifity.
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #4
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by hemebond
    This shows the first has higher specifity.
    And does nothing to explain why! Typical hemebondian post, no big deal.

    Check these out:

    http://www.w3.org/TR/CSS21/cascade.html
    http://www.htmldog.com/guides/cssadvanced/specificity/


  •  

    Posting Permissions

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