Solved

Make entire <li> clickable link

Posted on 2011-02-21
13
570 Views
Last Modified: 2012-05-11
I have a <ul> menu and I would like each <li> to be clickable no matter where you click in it.  Is there a good way to do this?
0
Comment
Question by:Bob Schneider
  • 6
  • 6
13 Comments
 
LVL 4

Accepted Solution

by:
andreizz earned 429 total points
ID: 34942824
Yes, use it like this:
<ul>
    <li><a href="google.com">Link 1</a></li>
    <li><a href="google.com">Link 2</a></li>
</ul>

Open in new window

0
 

Author Comment

by:Bob Schneider
ID: 34942950
Not working for this:

<ul style="list-style-image:url('/mobile/graphics/stopwatch.jpg');text-align:left;margin-left:45px;">
	
			<li style="height:25px;background-color:#ececd8;margin:5px;padding:0 0 5px 5px;">
				<a href="/mobile/welcome.asp" style="color:#293e6a;font-size:1.5em;">Welcome Page</a>

			</li>
			<li style="height:25px;background-color:#ececd8;margin:5px;padding:0 0 5px 5px;">
				<a href="/training/trng_home.asp" style="color:#293e6a;font-size:1.5em;">Training</a>
			</li>
		
</ul>

Open in new window

0
 
LVL 4

Assisted Solution

by:andreizz
andreizz earned 429 total points
ID: 34943005
you mean also the stopwatch img shown instead of the bullet?
0
 

Author Comment

by:Bob Schneider
ID: 34943035
Yes and the entire <li> is a link
0
 
LVL 4

Assisted Solution

by:andreizz
andreizz earned 429 total points
ID: 34943081
<ul>
    <a href="google.com"><li>Link 1</li></a>
   <a href="google.com"> <li>Link 2</li></a>
</ul>

Open in new window


then try this but it's not W3 valid.
0
 

Assisted Solution

by:doitniss
doitniss earned 71 total points
ID: 34943138
Try this
add the following to you css header or attached css fiile

.linkbox {
      height: auto;
      width: auto;
}

then add this to the you li list

<ul>
    <li><a href="google.com" class="linkbox">Link 1</a></li>
    <li><a href="google.com" class="linkbox">Link 2</a></li>
</ul>

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Bob Schneider
ID: 34943788
Nope.  Nothing yet.
0
 
LVL 4

Assisted Solution

by:andreizz
andreizz earned 429 total points
ID: 34943820
I seriously think that it cannot be done if you user list-style-image, if you make your own effect like list-style-image that will work.
0
 

Author Comment

by:Bob Schneider
ID: 34943906
I moved the image to inside the <a> and made the list-style: none.  Still no luck.
0
 
LVL 4

Assisted Solution

by:andreizz
andreizz earned 429 total points
ID: 34945421
You can't i'm telling you, it's because you can't modify that css property behaviour.

The only way to do this is to somehow put a div in front and make it behave like a bullet.
0
 

Author Comment

by:Bob Schneider
ID: 34945427
Thanks for your help!
0
 
LVL 4

Assisted Solution

by:andreizz
andreizz earned 429 total points
ID: 34945496
If you want, send me the stop watch picture and i will try the div work around.
0
 

Author Comment

by:Bob Schneider
ID: 34945708
You know it is not that big of a deal.  Thanks anyway!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to create a tile layout 1 38
How do i remove the outer scrollbar? 2 38
Applying an inline style that applies to child elements 2 36
Wrapper for APPs 9 36
"I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now