Page 1 of 1

Why isnt this valid HTML?

Posted: Sat Mar 17, 2007 4:53 am
by malcolmboston
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


[syntax="html"]
<div class="test">
   <a class="divLink" href="showitem.php?stockCode=72872" title="View this Artful Dodger Jungless Jeans">
   <img src="product_images/72872.jpg"  title="View this Artful Dodger Jungless Jeans"  alt="Artful Dodger Jungless Jeans" class="thumbnailOverview" />
   <div class="itemDescription3"><h1 class="itemDescription3">Artful Dodger</h1></div>
   <div class="itemDescription1"><h2 class="itemDescription1">Jungless</h2></div>
   <div class="itemDescription2"><h3 class="itemDescription2">Jeans</h3></div>
   <div class="itemDescription4">&pound;154.99</div>
   </a>
</div>
HTML validator whinges about unexpected </a>

any ideas? looks perfectly valid to me


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sat Mar 17, 2007 4:58 am
by mikeq
<a> is an inline element, they may only contain text and other inline elements.

<div> and <h1> etc are block elements.

thats your answer

Posted: Sat Mar 17, 2007 7:00 am
by malcolmboston
i really need, from an SEO POV, to keep the header tags in there, is there any way around this? seems rather stupid to me

Posted: Sat Mar 17, 2007 8:05 am
by onion2k
Make each element a seperate anchor rather than wrapping all the elements in a single anchor.

Posted: Tue Mar 20, 2007 4:58 am
by malcolmboston
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


follw-up.

Done that, same results

[syntax="html"]
<div class="test">
					<a class="divLink" href="showitem.php?stockCode=72879" title="View this Artful Dodger Faces Hoody"><img src="product_images/72879.jpg"  title="View this Artful Dodger Faces Hoody"  alt="Artful Dodger Faces Hoody" class="thumbnailOverview" /></a>
					<div class="itemDescription3"><h1 class="itemDescription3"><a class="divLink" href="showitem.php?stockCode=72879" title="View this Artful Dodger Faces Hoody">Artful Dodger</a></h1></div>
					<div class="itemDescription1"><h2 class="itemDescription1"><a class="divLink" href="showitem.php?stockCode=72879" title="View this Artful Dodger Faces Hoody">Faces<a/></h2></div>

					<div class="itemDescription2"><h3 class="itemDescription2"><a class="divLink" href="showitem.php?stockCode=72879" title="View this Artful Dodger Faces Hoody">Hoody</a></h3></div>
					<div class="itemDescription4"><a class="divLink" href="showitem.php?stockCode=72879" title="View this Artful Dodger Faces Hoody">&pound;129.99</a></div>
				</div>

feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Mar 20, 2007 5:03 am
by JayBird
Check the closing tag for "Faces" :wink: