Reputation: 3661
Trying to get following result when I hover
for markup below
<ul>
<li><a href="#">Current Month</a></li>
<li><a href="#">Current Week</a></li>
<li><a href="#">Previous Month</a></li>
<li><a href="#">Previous Week</a></li>
<li><a href="#">Next Month</a></li>
<li><a href="#">Next Week</a></li>
<li><a href="#">Team Calendar</a></li>
<li><a href="#">Private Calendar</a></li>
<li><a href="#">Settings</a></li>
</ul>
Can't figure out solution using CSS3 border-radius. Any suggestions?
Please don't post dotted lists. I need solution for arrowed list.
It's not same thing: when you use arrow, you need to set it as background-image
of li
.
There is another way, to set arrow as a bullet picture, but this time you have no way to control gap between arrow and link.
Upvotes: 2
Views: 175
Reputation: 1305
body {
background-color: #F3F3F3;
}
ul {
list-style: none;
margin: 0;
padding: 0;
font-family: Arial, Tahoma;
font-size: 13px;
border-left: 1px solid #4AFFFF;
padding-left: 10px;
}
li {
margin: 0;
padding: 0;
}
li:before {
content: " ";
display:inline-block;
border-style: solid;
border-width: 5px 0 5px 5px;
border-color: transparent transparent transparent #000000;
}
li a {
margin-left: 5px;
display: inline-block;
border-radius: 3px;
color: #000;
padding: 3px 5px;
text-decoration: none;
width: 150px;
}
li a:hover {
background-color: #DBDBDB;
font-weight: bold;
}
This should be ezactly how you want it!
Upvotes: 2
Reputation: 3360
li:hover {
background-color:#e4e4e4;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
EDIT
If you want to use arrows instead, just use the :before
pseudo element.
ul {
list-style-type:none;
}
li {
padding:5px;
}
li:hover {
width:100px;
background-color:#e4e4e4;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
li:before {
content:"> ";
}
Just replace the >
with your image.
EDIT 2
To have the background only over the text, just add that style to the link instead of the li
then.
EDIT 3
To use an image instead, just use url()
after content
li:before { content:url('http://www.nationalacademies.org/xpedio/groups/system/documents/webgraphics/na_right_arrow.gif') /* with class ModalCarrot ??*/
}
Upvotes: 3
Reputation: 240908
Something like this?
CSS
ul {
list-style:none;
background:#E6E6E6;
border-left:3px solid rgb(0, 194, 255);
}
li a {
text-decoration:none;
color:black;
}
li a:hover {
border-radius:5px;
background: #cacaca;
}
li:before {
content:"►";
font-size:10px;
margin-right:10px;
}
Upvotes: 2
Reputation: 19212
<style>
.my-list li a{
text-decoration:none;
color:#000;
}
.my-list li a:hover
{
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
text-decoration: none;
background-color: #e4e4e4;
}
.my-list li{
list-style-image:url(http://www.nationalacademies.org/xpedio/groups/system/documents/webgraphics/na_right_arrow.gif)
}
</style>
<ul class="my-list">
<!--Example of gap using whitespace-->
<li> <a href="#">Current Month</a></li>
<!--Example of a gap using padding for finer control of desired gap-->
<li><a style="padding-left:20px;" href="#">Current Week</a></li>
<li><a href="#">Previous Month</a></li>
<li><a href="#">Previous Week</a></li>
<li><a href="#">And so on...</a></li>
</ul>
See jsFiddle also: http://jsfiddle.net/KRaJN/3/
Upvotes: 3