Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using block spans inside A tags

Status
Not open for further replies.
Dec 8, 2003
17,047
GB

Does anyone know of any good reason not to do the following:

Code:
<a href=""><span style="display:block">xyz</span></a>

You can't use a div inside an a tag while keeping XHTML1.1 strict compatible, but the above code validates OK.

What I want to know are the pros and cons (if any) of doing this. Does anyone know of any cross-browser issues, display issues, etc with doing this?

Incidentally, i'm doing it so that I can set a width and height for the inner span, rather than doing this for the a tag itself.

Thanks,
Dan
 
I know it works in IE6, IE5.5, Mozilla, Netscape, Opera and Safari. I endorse it, since I used it in my pages. Same as you, I was avoiding validation problems by using divs. I haven't found a problem so far.
 

Yup - I was getting display problems, but found those were caused by something else...

The block spans work great for me now, too.

Thanks,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top