denislexic denislexic - 1 year ago 62
CSS Question

Are you allowed to nest a link inside of a link?

This may seem pretty basic, are you allowed to put a link inside of a link? See attached image below:

enter image description here

I'm trying to have the whole grey bar clickable to go somewhere, but if the user clicks the wheel or the move arrow, they are other links. See my current code:

<a href="#" class="sp_mngt_bar">
<h1><?php echo $v; ?></h1>
<a href="#" class="t_icons t_icons_settings sp_mngt_settings"></a>
<a href="#" class="t_icons t_icons_move sp_mngt_move"></a>

Is this a good practice? Am I doing it wrong? How would you do this?
Thanks for the help!

Answer Source

Straight from the W3C for HTML4:

12.2.2 Nested links are illegal

Links and anchors defined by the A element must not be nested; an A element must not contain any other A elements.

Since the DTD defines the LINK element to be empty, LINK elements may not be nested either.


And for HTML5 it is a little different.

You cannot have Interactive Content inside an A element. Interactive Content includes anchor tags.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download