469,304 Members | 2,192 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

A whole div or p as link - possible?

Hi folks,

is it possible, in a way compliant to XHTML strict, to make a whole
div or a whole paragraph a link? More general, how to make a block
element a link? I mean something like:

[...]
<a href="http://subdom.dom.de/">
<p>
Test1<br />
BlaBlaBlaBlaBlaBla<br />
Test2<br />
</p>
</a>
[...]

This code works in newest Opera, IE and Mozilla, but it's not
compliant to XHTML strict. The purpose would be that the whole
rendering area (i.e. the whole (commonly rectangular) box) of the
paragraph acts as a link, and not only the text (or other contents)
within the paragraph.

What's the easiest method to achieve this in a way compliant to XHTML
strict?

Thank you very much,

Peter
Jul 20 '05 #1
2 4070
in post: <news:65*************************@posting.google.c om>
it*@omeganet.de (Peter Pfannenschmid) said:
is it possible, in a way compliant to XHTML strict, to make a whole
div or a whole paragraph a link?
a{display:block;width:100%;height:100%;}
<a href="http://subdom.dom.de/">
<p>
Test1<br />
BlaBlaBlaBlaBlaBla<br />
Test2<br />
</p>
</a>
[...]

This code works in newest Opera, IE and Mozilla, but it's not
compliant to XHTML strict.


it only works by accident, its invalid
--
brucie - i usenet nude
Jul 20 '05 #2
On 31 Jan 2004 14:21:44 -0800, it*@omeganet.de (Peter Pfannenschmid)
wrote:
is it possible, in a way compliant to XHTML strict, to make a whole
div or a whole paragraph a link?


No good reason why you shouldn't, but the DTD forbids it.

The "XHTML way" to do this, would be to embed <span> and similar
%inline; elements, then to use CSS to style them with display:block;
as if they were a <div>

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Thomas Mlynarczyk | last post: by
50 posts views Thread by Michael Mair | last post: by
19 posts views Thread by Martin Eyles | last post: by
4 posts views Thread by Abhay | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.