|  | Posted by richard on 01/09/08 16:47 
On Tue, 8 Jan 2008 19:23:08 +0000 (UTC), Fister<vil_ikke@have_spam.dk> wrote:
 
 >Since anchors are inline elements and divs are block elements the validation
 >doesn't permit me placing an anchor around a div like the following:
 >
 ><div id="containers">
 >  <a href="page.html">
 >  <div class="container">
 >    <img alt="image" src="image.jpg" />
 >    <div class="heading">Heading</div>
 >    <div class="text">Text</div>
 >  </div>
 >  </a>
 ></div>
 >
 >I want for the heading and text to change color whenever the mouse is above
 >the image, heading or text. I also want for the image, heading and text to
 >be below eachother so that's why I'm using divs and not spans.
 >
 >Isn't this common code and how do I make it valid?
 >
 
 You get the error because you can not "anchor" a division.
 
 you show <div><a><div></div></a></div>
 the anchor is intended primarily for a link.
 So that you would have <div><a>link</a></div>
 
 I would not use "container" and "containers" as this could be
 confusing. "container1" and "container2" would be more appropriate.
 I generally go with something like "acontainer" and "bcontainer".
  Navigation: [Reply to this message] |