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 10 of 10
  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    4
    Member #
    15747
    My site at http://distrogue.awardspace.com is completely hand-coded, so I decided one day to use the w3c validator to see how badly-made it was. Surprise- 61 errors! I have it down to 16, but I'm having trouble with the rest of it.
    My site runs on a combination of in-page PHP scripts, JavaScript-set cookies, and a central CSS stylesheet. The stylesheet defines a few tags, but the validator doesn't like them. Here's an example: In the stylesheet, I have:
    Code:
    #nav-menu heading {...}
    When I use the "id=nav-menu" field, I should be able to use a <heading> tag to use that. But the validator complains about that.
    More to the point, when you look at the site, you'll see all the text a lot smaller than I had it originally. That was the result of adding a DOCTYPE at the beginning. I'm not sure why it does that, but it does.
    Can anyone help me?

  2.  

  3. #2
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    You can't just add on new elements like that, (there is no <heading> tag... right?), unless you add them on in the DOCTYPE. The DOCTYPE sets which elements you can make and what properties you can set on them. You can't just add in your own tags, unless you add them in your doctype.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  4. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    4
    Member #
    15747
    And how do I do that? No, there isn't a <heading> tag in standard HTML.

  5. #4
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    DOCTYPE modification is often unnecessary. You already have everything you need. Use <h1>, <h2> and so on for your headings. And this helps search engines.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  6. #5
    Junior Member
    Join Date
    Aug 2007
    Posts
    4
    Member #
    15747
    The <heading> tag also has a background image. I probably need one.

  7. #6
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Huh? What're you talking about? Any tag can be given a background image...
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  8. #7
    Senior Member Ferro's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    386
    Member #
    14204
    Liked
    5 times
    Therre's no reason why you can't have a well designed attractive site that uses valid CSS.

  9. #8
    Junior Member
    Join Date
    Aug 2007
    Posts
    4
    Member #
    15747
    The tag was defined in CSS, and it has a background image. The parser chokes on it, and so I can't just use <h1>.
    @^, what?

  10. #9
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Wait a sec. Lets get this straight. You can't simply create a new tag by "defining" it in CSS. And there's no reason you can't just use <h1>. Try changing that CSS selector into

    Code:
    #nav-menu h1 {...}
    and replace each <heading> with <h1> (although in reality you'll want to make a proper hierarchy).
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  11. #10
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You can't add tags on the fly using CSS; you can only do it by extending the W3C-provided doctype, and it's very far from the proper solution.

    Instead of using a <heading> tag, use the appropriate <hn> tag for the level of the header. If it's the page's title, use <h1>. If it's the title of part of the content area, identifies some major structural component, etc, use an <h2>, and so on down to <h6> if necessary.

    Remember that headers shouldn't skip levels; you shouldn't have, say, an <h4> followed by an <h6> because you're missing an <h5> somewhere.

    As for your fonts changing size, IE is a piece of garbage and enters "quirks mode" if you omit the doctype. Adding it puts it into a (sorry excuse of a) standards mode and it attempts to follow W3C standards more closely. The way it was rendering before a doctype was actually incorrect.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


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 03:25 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com