Why isnt this valid HTML?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Why isnt this valid HTML?

Post 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]
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post 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
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Make each element a seperate anchor rather than wrapping all the elements in a single anchor.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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]
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Check the closing tag for "Faces" :wink:
Post Reply