Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css How to add round corners when hover li element?

Tags:

css

I want to add round corners to a li element when hovered:

My HTML:

<ul>
<li id="menufirst">
<span id="menu1"></span>
<a href="#">Menu 1</a>
</li>
<li>
<span id="menu2"></span>
<a href="#">Menu 2</a>
</li>
<li>
<span id="menu3"></span>
<a href="#">Menu 3 </a>
</li>
</ul>

Example of want I want to archive: enter image description here

I already have some CSS to make the menu horizontal.

like image 899
Rails beginner Avatar asked Oct 21 '11 12:10

Rails beginner


People also ask

How do you make a hover round in CSS?

You can use the "border-radius" CSS property to add rounded corners to an element's outer border edge by defining the radius of the element's corners. You can use pixels or percentage to set the border-radius.

Which CSS property can be used to give rounded corners to an element?

The border-radius CSS property rounds the corners of an element's outer border edge.

How do I make rounded corners of an image in CSS?

Style your corners.The border-radius CSS property is what adds the rounded corners. You can experiment with different values to get it the way you like. border-radius: 75px; If you want it to be a circle, add border-radius: 50%; .


1 Answers

li:hover{
  -moz-border-radius-topleft: 10px;
  -moz-border-radius-topright: 10px;
  -moz-border-radius-bottomright: 0px;
  -moz-border-radius-bottomleft: 0px;
  -webkit-border-radius: 10px 10px 0px 0px;
  border-radius: 10px 10px 0px 0px;
  background-color: #000;
}

li{
  width: 50px;
  height: 50px;
  margin: 30px;
  float: left;
  padding: 10px;
}

li a{
  color: #0070C0;
  font-size: 14px;
  text-decoration: none;
}
like image 181
Riz Avatar answered Sep 18 '22 16:09

Riz