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 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jul 2003
    Posts
    601
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Why no validation?

    So I get this error when trying to validate:

    Line 56, column 128: ID "mgrey" already defined (explain...).

    I'm using this ID within a DIV multiple times. What am I supposed to do? Create mgrey1, mgrey2, etc. that are all the same? The whole point of the CSS is to make changes in only one spot.

    Am I missing something?

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Id is a way to identify a single element. No more than one element may have the same id. If you want to use CSS to style many elements, use class instead.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Regular Coder
    Join Date
    Jul 2003
    Posts
    601
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Doh! Thank you.

    You can use SPAN tags with a class reference correct?

  • #4
    Regular Coder
    Join Date
    Jul 2003
    Posts
    601
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Hmm .. I have this:

    #lgrey {
    color: #ccc;
    }

    <li class="dgrey">2004 Schedule<br /> <span id="lgrey">is</span> <span id="mgrey">Posted Here</span></li>

    While this is a bit messy, if I change the <span id="lgrey"> to <span class="lgrey">, it doesn't work.

    Any idea why?

    Thanks.

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    The CSS syntax for simple selectors goes something like this:

    namespace|element.class#id:pseudoclass::pseudoelement

    Thus, you should use elm.class instead of elm#id if you want to address an element with a certain class.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    so just change this:

    #lgrey {
    color: #ccc;
    }

    to this:

    .lgrey {
    color: #ccc;
    }
    OracleGuy

  • #7
    Regular Coder
    Join Date
    Jul 2003
    Posts
    601
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Thanks OG ...

    So again, how would you define the difference between the use of "#" vs. "."?

  • #8
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Hmm, maybe that would be best explaind this way: <http://www.w3.org/TR/2001/CR-css3-se...113/#selectors>
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #9
    Regular Coder
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You use # when you're referring to ID's, and you use . when you're referring to classes.


  •  

    Posting Permissions

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