html - How to make whole list item clickable -


I was wondering how I could make the entire list item clickable and not just words. In my list, I'm able to click on words only. How can I change the entire list area to a link? My list contains a link inside it but I want you to click anywhere within the list area to redirect. Thank you.

And I'm new to this website so I'm sorry if I am saying this wrong.

You need to make the anchor tag a block element and control the height of the list item < / P>

Here's a sample:

HTML:

  & lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Click me! & Lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

CSS:

  ul {width: 200px; Padding: 0px; Margin: 0px; List-style: none; } Li {Width: 100%; Background: green; Status: Relative; } Li A {display: block; Height: 50px; }  

jsfiddle:


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -