SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Validation error

    Hey,

    This code gives a validation error when checked with w3c's validator.
    HTML Code:
    <div>
    	<a href="http://validator.w3.org/check?uri=referer"><img
    			src="http://www.w3.org/Icons/valid-xhtml10"
    			alt="Valid XHTML 1.0 Strict" height="31" width="88" />
    		</a>
    </div>
    I know it's a block element contained in an inline-element but how else can I fix this ?

  2. #2
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,888
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    There's nothing wrong with as a fragment - <img> is an inline element, so it can go inside <a>.

    It won't validate if you just put it into the validator like that, because it wants a whole page - but if you include it within an XHTML page, you shouldn't get any validation errors from it. If you do, post a link to your page and we'll see what else is causing it.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok here is the page: www.haasfazant.co.cc - Click on the w3c validation icon and you will see it doesn't validate.

    Friendly greetings,

    Ajajajak

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You did not post the actual code present on your page.
    It's:
    HTML Code:
    <div id="footer">
    	<a href="http://validator.w3.org/check?uri=referer"><img
            src="http://www.w3.org/Icons/valid-xhtml10"
            alt="Valid XHTML 1.0 Strict" height="31" width="88" />
    	<a href="http://jigsaw.w3.org/css-validator/check/referer">
            <img style="border:0;width:88px;height:31px"
                src="http://jigsaw.w3.org/css-validator/images/vcss"
                alt="Valid CSS!" />
        </a>
    	</a>
    </div>
    And it seems obvious to me what the error is. Do you see it?

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah i must have uploaded an older version to the server because it doesn't show an extra </a> tag in my notepad...hehe. I think that should fix it

    Thanks for pointing it out

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    It's not exactly an 'extra' </a>, it's an </a> at the wrong spot, creating an <a> inside an <a>

  7. #7
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are right. I went too quick


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
  •