Forum Moderators: not2easy

Message Too Old, No Replies

ul as href

         

cdmn

9:25 pm on Sep 19, 2007 (gmt 0)

10+ Year Member



hi

the task is simple, i need whole UL to be one hyperlink.
Something like this:

<a href="">
<ul>
<li>text</li>
<li>text</li>
</ul
</a>

then on hover i could change ULs background-color.
The only problem is, that such construct: block element in inline element is not allowed and such xHTML code will not validate.

Any suggestions? :-)

Xapti

11:07 pm on Sep 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it's not valid to set a{display:block}?
You're posting in the CSS section, so I assume that's what you want?

[edited by: Xapti at 11:07 pm (utc) on Sep. 19, 2007]

Marshall

12:43 am on Sep 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



cdmm,

If you ARE NOT using xml, then you should read this [webmasterworld.com].

As for the other, why are you using a <ul>? Why not:
<a href="">text<br>text</a> and use padding and/or margins to achieve the effect of a <ul>.

Marshall

cdmn

1:20 am on Sep 20, 2007 (gmt 0)

10+ Year Member



I really dont think that putting CSS style to 'a' will force w3c validator to validate such HTML code. But ill test it first thing in the morning.

As for using <a>text<br />text</a>... hm..

I need to simulate tabular data of 3 cells. All cells will share a background image. When ill hover no matter what cell, background image must be changed.

Cant really think of other solution then <a><ul>..</ul></a>, without using javascript and cross-browser of course.

Any suggestions? :-)

Robin_reala

12:17 pm on Sep 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No way around this unfortunately unless you're willing to drop IE6 support. Or use Javascript. If you can drop IE6 support then you can easily do:

ul { background: red; }
ul:hover { background: blue; }