First step: Edit the HTML code of the menu
The menu contains three list items, named "Menu1", "Menu2", "Menu3", respectively.
?
1234567 |
< div class = "css3Menus" > < ul > < li >Menu1</ li > < li >Menu2</ li > < li >Menu3</ li > </ ul > </ div > |
Step Two: Set the background of the menu
In this step, we will set the background of the navigation to black. The width, height, and padding are optional and may not be set.
?
1 |
.css
3
Menus {
background
:
#14080a
;
width
:
506px
;
height
:
260px
;
padding
:
20px
;
}
Step three: Use Border-radius to make circular navigation. In this step, we'll take advantage of some of CSS3 's cool features, especially Border-radius, to set the background of each list item to yellow and shape to round. ?
1234567891011121314151617 |
ul {
list-style
:
none
;
}
li {
float
:
left
;
font
:
14px
/
10px
Arial
,
Verdana
,
sans-serif
;
color
:
#FFF
;
background-color
:
#CCCC00
;
width
:
80px
;
height
:
80px
;
padding
:
20px
;
margin
:
0
30px
0
0
;
-webkit-border-radius:
60px
;
-moz-border-radius:
60px
;
border-radius:
60px
;
}
|
Fourth Step: Set the alignment of the menuIn this step, we'll set a specific background color and location for each list item: ?
|
li#menu
1
{
background-color
:
#00FFCC
;
}
li#menu
2
{
background-color
:
#CC9900
;
margin-top
:
100px
;
}
li#menu
3
{
background-color
:
#33FF66
;
margin-top
:
50px
; }
Fifth step: Set the alignment of links in the menu ?
123456789101112131415161718192021 |
li a {
color
:
#FFF
;
text-decoration
:
none
;
display
:
block
;
width
:
80px
;
height
:
45px
;
text-align
:
center
;
padding
:
35px
0
0 0
;
margin
:
0
40px
0
0
;
-webkit-border-radius:
40px
;
-moz-border-radius:
40px
;
border-radius:
40px
;
}
li#menu
1
a {
background-color
:
#FF0000
;
}
li#menu
2
a {
background-color
:
#660033
;
}
li#menu
3
a {
background-color
:
#66CCCC
;
}
Sixth step: Define another effect that unfolds when the mouse hovers over the link ?
1234567891011 |
li a:hover, li a:focus, li a:active { width : 120px ; height : 65px ; padding : 55px 0 0 0 ; margin : -20px 0 0 -20px ; -webkit-border-radius: 60px ; -moz-border-radius: 60px ; border-radius: 60px ; } |
Seventh Step: Finally add animation to the navigation?
1234567891011 |
li a:hover, li a:focus, li a:active { -webkit-animation-name:bounce; -webkit-animation-duration: 1 s; -webkit-animation-iteration-count: 4 ; -webkit-animation- direction :alternate; } @-webkit-keyframes bounce{from{ margin : 0 40px 0 0 ;} to{ margin : 120px 40px 0 0 ;} } |
|
|
|
Create gorgeous dynamic CSS3 menus without images and JS