By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,246 Members | 1,401 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,246 IT Pros & Developers. It's quick & easy.

A whole div or p as link - possible?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.