SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict Huscy's Avatar
    Join Date
    Jul 2002
    Location
    Newcastle, UK
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Validation issue (XHTML strict)

    I'm getting this (and only this) problem when validating my site:

    # Line 57, column 40: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag

    i think this has something to do with block level elements and such like, but dont understand, can anyone help?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    Just try to add one of the block-level elements around the input field... input fields are inline. Admittedly, though, it's just the W3C's nitpicking.

    Compuwhiz7

  3. #3
    SitePoint Addict Huscy's Avatar
    Join Date
    Jul 2002
    Location
    Newcastle, UK
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol thanks i just stuck a <div> around them - another question, why can't you use a <div> as a link, ala
    <a href=bar><div class=foo></div></a>

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Huscy
    lol thanks i just stuck a <div> around them - another question, why can't you use a <div> as a link, ala
    <a href=bar><div class=foo></div></a>
    Because an <a> tag is an INLINE element, while a <div> is a BLOCK-LEVEL element. A block-level element can have inline content, but not the other way around. Imagine it as trying to stick a TV inside of a small Tupperware container; it just won't work.

  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)
    Also, you must have a block level element inside a form before an inline one, meaning, you can't have an input without it being surrounded by like a <div>
    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 Addict Huscy's Avatar
    Join Date
    Jul 2002
    Location
    Newcastle, UK
    Posts
    318
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol, damned picky w3c - so any idea how i can have a <div> link to a page? the reason i say this is because my site is going to feature a color (stylesheet) changer, therefore i cant use an <img> tag for the logo, and must use a <div>, which is customarily linked back to the homepage... but i cant directly link without de-validating my page

  7. #7
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,803
    Mentioned
    158 Post(s)
    Tagged
    4 Thread(s)
    Hi,
    the reason i say this is because my site is going to feature a color (stylesheet) changer, therefore i cant use an <img> tag for the logo, and must use a <div>, which is customarily linked back to the homepage
    I think you'll need to put that question in English as I didn't understand a word of it (lol).
    the reason i say this is because my site is going to feature a color (stylesheet) changer, therefore i cant use an <img> tag for the logo
    What do these have to do with each other?
    and must use a <div>,
    Why? What for? A div is just a block level container.
    and must use a <div>, which is customarily linked back to the homepage
    Why are divs cutomarily linked back to the home page??
    so any idea how i can have a <div> link to a page
    A link links to a page not a div e.g. <a href="#">Hello</a>

    If you mean can you make the whole div active to a mouse click then you can use something like.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    .outer {
    width:100px;
    height:100px;
    background:red;
    }
    .outer a {display:block;width:100%;height:100%}
    .outer a:hover {background:yellow}
    </style>
    </head>
    <body>
    <div class="outer"> <a href="#">Hello </a></div>
    </body>
    </html>
    But i'm not sure if that's what you are talking about .

    Paul

  8. #8
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    Sorry to be a bit behind on posting here, but I'm glad to hear that my suggestion helped. Also, everyone's right about the links: you can't put a block-level element into an inline element, but you can (and must) do it vice versa.

    Compuwhiz7

  9. #9
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Europe
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In XHTML2 we will be able to turn any element into a link.

  10. #10
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Huscy
    lol, damned picky w3c - so any idea how i can have a <div> link to a page? the reason i say this is because my site is going to feature a color (stylesheet) changer, therefore i cant use an <img> tag for the logo, and must use a <div>, which is customarily linked back to the homepage... but i cant directly link without de-validating my page
    Code:
    <div onclick="location.href='/';"></div>
    or
    Code:
    div a {
      display: block;
    }
    Code:
    <div><a href="/"></a></div>
    or you can use an imagemap? Or *gasp* break convention and just offer a regular text link back home somewhere else on your page?


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
  •