r/csshelp • • Aug 02 '16

Help with navigation menu

I have a navigation menu and I would like it so that the entire <li> is a clickable link. Right now it is only clickable on the text.

I would also like to add a submenu to the links if that is possible.

This is what I have right now http://codepen.io/anon/pen/dXqJdp

6 Upvotes

2 comments sorted by

2

u/gavin19 Aug 02 '16

Only the text is clickable because that's the link. You can't make an li clickable.

I see you've got width: 100%; in the nav ul li a block. Links are inline elements, i.e they have display: inline; applied by default. Those elements with that display type will ignore height/width properties.

If you replace width: 100%; with display: block; it'll make the links automatically fill the width of the li.

1

u/kamereonesec Aug 03 '16

Thank you, that's exactly what I wanted for that.