user1976940
user1976940

Reputation: 19

How to make span work being outside of the anchor to work like its inside of it

I have a markup like which i have given below : I have given some link to the anchor tag but I want user to click anywhere on the li tag to make link redirect to link given to anchor tag but i cannot place my span inside the anchor tag ,it has to be outside of the anchor tag.what will be the css for that and it should work in IE also.

<ul>
   <li>
       <span> 1 </span>
       <a href="">Click any where in the li i will take u to somewhere</a> 
  </li>

</ul>

Upvotes: 0

Views: 332

Answers (2)

Muteking
Muteking

Reputation: 1513

You can't modify the document object model with css. You would need a javascript function for that.

Upvotes: 1

Mike Chamberlain
Mike Chamberlain

Reputation: 42480

You could try something like:

<li onlick="window.location.href='your.url'"> ... </li>

Upvotes: 0

Related Questions