SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast Remy's Avatar
    Join Date
    Oct 2002
    Location
    Amsterdam
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    # in the place of a point?

    I have seen the use of # in stylesheets ( #nav {} instead of .nav{}), but what is the reason for this? Is it better?

  2. #2
    The Legend Indian's Avatar
    Join Date
    Nov 2001
    Location
    Gods' Own Country
    Posts
    890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    # is used for id.

    for example:
    Code:
    <style type="text/css">
    <!--
    
    #myid1 { color: #FF0000 }
    #myid2 { color: #0000FF }
    
    -->
    </style>
    
    <span id="myid1">Red</span><br />
    <span id="myid2">Blue</span>
    The difference between class and id:
    http://www.webmasterworld.com/forum83/231.htm
    http://www.milov.nl/forum/1/24
    Death --the last sleep? No, it is the final awakening.

    TinyPlanet.org
    Discuss and Debate World Events, Politics and Religion

  3. #3
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to elaborate on the above post: ID is unique to a single element on your page, whereas a class (defined with the dot) can be applied to a variety of elements.
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  4. #4
    SitePoint Enthusiast Remy's Avatar
    Join Date
    Oct 2002
    Location
    Amsterdam
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your explanations. Mine code has now <div id="menu" class="menu"> and I always found this irritating, but I can now get rid of this with #!
    Last edited by Remy; Jan 21, 2003 at 04:40.


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
  •