|
Posted by Harlan Messinger on 01/08/08 19:36
Fister 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.
It looks more like you want the user to be taken to page.html when the
user clicks on 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 can use onclick inside the div tags, but then your page won't work
with Javascript turned off.
You can have three separate anchors that go to the same place, one
around the image and the other two inside the heading and text divs.
Or you can reassess whether your users *really need* to have so many
different things to click on to go to the same place, or whether one
will suffice.
Navigation:
[Reply to this message]
|