I would like to do this so that the clickable region on the tag is size of the LI
.
My html looks like:
<li> <a href="#">Link</a> </li>
To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size. HTML5 do not support the <font> tag, so the CSS style is used to add font size.
The HTML <area> tag defines a clickable area (or hotspot) inside of an image map. You can associate a hyperlink with this clickable area. This tag must be within a <map> tag. This tag is also commonly referred to as the <area> element.
As others have said
li a { display: block; }
should achieve what you're after. But you must also remove any padding from the <li> and set it on the <a> instead. For example:
li { padding: 0; } li a { display: block; padding: 1em; }
In CSS:
li a { display: block; }
Of course, you'll want to make your selector more specific than that.
<ul> <li class="myClass"> <a href="#">Link</a> </li> </ul> li.myClass a { display: block; background-color: #fdd; /* Demo only */ }
http://jsfiddle.net/userdude/jmj2k/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With