SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot ComputerBob's Avatar
    Join Date
    Jul 2003
    Location
    USA
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The W3C CSS Validator LIED to me!

    Just a lesson learned about trusting the online W3C CSS validator. After validating fine for the past week, late this afternoon, my CSS suddenly wouldn't validate.

    The W3C validator kept telling me that I had an ERROR ON LINE 0. Unrecognized : }

    I couldn't see anything wrong with my stylesheet, so I tried selecting all of its text and copying it to a new file. That resulted in the same validation error. I tried using an old, valid backup of the stylesheet, and carefully copying new styles to it from the "bad" stylesheet. After a few minutes of that, the valid backup got the same error message from the online validator.

    After pulling my hair out for a couple of hours, I finally discovered an extra }, sitting all by itself.

    IT WAS ON LINE 629.
    ComputerBob - Making Geek-Speak Chic™
    http://www.computerbob.com
    - XHTML 1.0 Strict + CSS Layout
    Ratings | Forums | Software | Polls | Weird | Quotes | Weather
    Guest Articles | Free Greeting Cards | CB Awards | Search

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ComputerBob

    After pulling my hair out for a couple of hours, I finally discovered an extra }, sitting all by itself.

    IT WAS ON LINE 629.
    Welcome to the world of programming errors. Usually the error isn't on the line reported, but about 5-8 lines up .

  3. #3
    SitePoint Zealot Tygger2512's Avatar
    Join Date
    Jul 2003
    Location
    Pittsburg, KS
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In my experience the CSS validator only ever reports errors as being on line 0... useful, huh?

    Line 629 - man, that is one big CSS file Bob! Is there any way of trimming that, as I imagine that takes up a fair amount of memory to cache...

    Andy.
    Learn the Emotional Freedom Technique at www.as-if-by-magic.com

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Tygger2512
    Line 629 - man, that is one big CSS file Bob! Is there any way of trimming that, as I imagine that takes up a fair amount of memory to cache...
    Definitely . Try using CSS shorthand to save yourself a few bytes here and there. You'll see how much it can help you.

  5. #5
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't get me started on IE's Javascript Debugger.

    PHP's pretty good about line numbers though.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  6. #6
    SitePoint Zealot ComputerBob's Avatar
    Join Date
    Jul 2003
    Location
    USA
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just KNEW you guys would jump at the length of my stylesheet.

    I'm sure I'll be able to shorten it somewhat, once I know that it's done. It's about 14K in size, but it currently has a lot of whitespace and comments, to help me remember WHY I put certain things in there, and to serve as lessons to Web design students who view it.
    ComputerBob - Making Geek-Speak Chic™
    http://www.computerbob.com
    - XHTML 1.0 Strict + CSS Layout
    Ratings | Forums | Software | Polls | Weird | Quotes | Weather
    Guest Articles | Free Greeting Cards | CB Awards | Search

  7. #7
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Jeff Lange
    Don't get me started on IE's Javascript Debugger.
    "Not Implemented"

  8. #8
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off topic?

    I found on your homepage at: http://www.computerbob.com/

    Somewhere in your document you've linked to the nonexistent internal link "primarycontent" by using <a href="#primarycontent"> ... </a>. You should remove this link or make sure that it links to somewhere in your document by using <a name="primarycontent"> ... </a> or <element id="primarycontent"...>.

    Just FYI.

  9. #9
    SitePoint Zealot Tygger2512's Avatar
    Join Date
    Jul 2003
    Location
    Pittsburg, KS
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Webnauts
    Off topic?

    I found on your homepage at: http://www.computerbob.com/

    Somewhere in your document you've linked to the nonexistent internal link "primarycontent" by using <a href="#primarycontent"> ... </a>. You should remove this link or make sure that it links to somewhere in your document by using <a name="primarycontent"> ... </a> or <element id="primarycontent"...>.

    Just FYI.
    Bob has a div with an id of "primarycontenthome" - I think this is where the skip navigation link is supposed to take you to - he needs to add the 'home' part into his skip navigation link.

    Andy.
    Last edited by Tygger2512; Oct 9, 2003 at 07:04.
    Learn the Emotional Freedom Technique at www.as-if-by-magic.com

  10. #10
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If we are talking about this CSS file http://www.computerbob.com/css/styles.css
    there are definetely some issues which need to fixed:

    Lines 64, 111, 174, 191, 638, 650: The "width" property has already been often defined in this style rule. A property should only be defined once per rule.

    Lines 65, 112, 168, 192, 639, 651: The "width" property has already been often defined in this style rule. A property should only be defined once per rule.

    Line 145: The "margin" shorthand property and the "margin-left" property have both been used. The "margin" shorthand property already defines the following properties: "margin-bottom", "margin-left", "margin-right", and "margin-top". Therefore, the "margin-left" property has been defined twice. Consider using only the "margin" shorthand property.

  11. #11
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Webnauts
    If we are talking about this CSS file http://www.computerbob.com/css/styles.css
    there are definetely some issues which need to fixed:

    Lines 64, 111, 174, 191, 638, 650: The "width" property has already been often defined in this style rule. A property should only be defined once per rule.

    Lines 65, 112, 168, 192, 639, 651: The "width" property has already been often defined in this style rule. A property should only be defined once per rule.

    Line 145: The "margin" shorthand property and the "margin-left" property have both been used. The "margin" shorthand property already defines the following properties: "margin-bottom", "margin-left", "margin-right", and "margin-top". Therefore, the "margin-left" property has been defined twice. Consider using only the "margin" shorthand property.
    Those sound only like warnings, not errors. You still pass for valid CSS if you get warnings but no errors. I suspect that the duplicate width properties are because of the box model hack as well.

  12. #12
    SitePoint Zealot ComputerBob's Avatar
    Join Date
    Jul 2003
    Location
    USA
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tygger2512
    Bob has a div with an id of "primarycontenthome" - I think this is where the skip navigation link is supposed to take you to - he needs to add the 'home' part into his skip navigation link.

    Andy.
    That's exactly right. It appears that I forgot to change that "Skip Navigation" link on my home page when I changed the name of my primary content div on that page. The primary content div on my home page is "primarycontenthome," while it is "primarycontent" on all the other pages on my site. I did that so that I could define my home page as having 3-columns, while the rest of my site has 2 columns.

    Thanks for the attention to detail, everyone! I'll check out the other "warnings" that you've pointed out. I know I have some redundant CSS code, and I suspect that at least a few of the warnings involve the box model hack, as Vinnie suspected.

    Zeldman is right - validation is a continuum, not an end destination.

    Edit:

    Except for the warning about line 145, all of the other warnings about redundant "width" properties were due to my use of the box model hack.
    Last edited by ComputerBob; Oct 9, 2003 at 08:17.
    ComputerBob - Making Geek-Speak Chic™
    http://www.computerbob.com
    - XHTML 1.0 Strict + CSS Layout
    Ratings | Forums | Software | Polls | Weird | Quotes | Weather
    Guest Articles | Free Greeting Cards | CB Awards | Search


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
  •