Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member mikeycorn's Avatar
    Join Date
    Mar 2003
    Posts
    272
    Member #
    891
    Hello Friends,

    Just wondering what the deal is with the #'s in this .css I'm checking out.

    Code:
    body {
    	background: black;
    	text-align: center;
    	color: white;
    	font: 11px verdana, sans-serif;
    }
    #wrapper {
    	text-align: left;
    	margin: 15px auto;
    	width: 778px;
    	position: relative;
    	background: maroon url(images/bg.jpg) repeat-y;
    	border: 5px solid #750306;
    }
    How is that different than say the periods for instance?
    ~ mikeycorn
    With over 72,000 questions worth of user submitted quizzes, it's the world's most popular quiz creation software:
    PEST - The Personal Exam Self-Tester

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    period references a class
    pound references an id

    <div id="12345" class="normal">

    could be defined in multiple ways with CSS (outlined in increasing specificity, below)
    Code:
    div {
       /* applies to all divs */
    }
    
    .normal {
       /* applies to all elements with class="normal" */
    }
    
    div.normal {
       /* applies to all divs with class="normal" */
    }
    
    #12345 {
       /* applies to the singular instance of an element with id="12345" */
    }
    
    div#12345 {
       /* applies to the singular instance of a div with id="12345" */
    }

  4. #3
    Senior Member mikeycorn's Avatar
    Join Date
    Mar 2003
    Posts
    272
    Member #
    891
    Awesome, thanks for the reply. On the second to last I think you mean

    Code:
    #12345 {
    /* applies to the singular instance of an element with id="12345" */
    }
    right?

    So with the singular instance, it's only supposed to happen one time in your page?
    ~ mikeycorn
    With over 72,000 questions worth of user submitted quizzes, it's the world's most popular quiz creation software:
    PEST - The Personal Exam Self-Tester

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Yes, if you have
    HTML Code:
    id="12345"
    more than once on a page then if you went to validate your page you would get errors. If you plan to use it more than once then make it a class.

  6. #5
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Though, by the way, the browser may theoretically still apply it to all elements with the id, or to any one random element that has the id. It depends on the implementation. It should only appear once so none of these unpredictabilities occur.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:52 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com