Hello readers, today we will discuss on how to make creative menus in css3. First let us make menus like Home, About Us, Services , Our Team and Contact Us in <ul> <li>. I have taken a class main-wrapper, which enclosed all the menus, inside "main-wrapper, there is a class "wrapper-menu". This class has css width:500px, height:100px, display:block and transition: all 300ms ease-in-out. Below is html code for making animated menus:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div class="main-wrapper">
<ul class="wrapper-menu" >
<li>
<a href="#">
<span class="wrapper-icon">L</span>
<div class="wrapper-content">
<h2 class="wrapper-main">Home</h2>
<h3 class="wrapper-sub">Landing Page</h3>
</div>
</a>
</li>
<li>
<a href="#">
<span class="wrapper-icon">W</span>
<div class="wrapper-content">
<h2 class="wrapper-main">About Us</h2>
<h3 class="wrapper-sub">Who we are</h3>
</div>
</a>
</li>
<li>
<a href="#">
<span class="wrapper-icon">O</span>
<div class="wrapper-content">
<h2 class="wrapper-main">Services</h2>
<h3 class="wrapper-sub">Our Products</h3>
</div>
</a>
</li>
<li>
<a href="#">
<span class="wrapper-icon">P</span>
<div class="wrapper-content">
<h2 class="wrapper-main">Our Team</h2>
<h3 class="wrapper-sub">People in our Team </h3>
</div>
</a>
</li>
<li>
<a href="#">
<span class="wrapper-icon">O</span>
<div class="wrapper-content">
<h2 class="wrapper-main">Contact Us</h2>
<h3 class="wrapper-sub">Our Offices</h3>
</div>
</a>
</li>
</ul>
</div><!-- main-wrapper-->
</body>
</html>
Now copy the below code in your css file style.css
.wrapper-menu{
padding: 0;
margin: 20px auto;
width: 500px;
}
.wrapper-menu li{
width: 500px;
height: 100px;
overflow: hidden;
display: block;
background: #ffe6e6;
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
margin-bottom: 4px;
border-left: 10px solid #000;
-webkit-transition: all 300ms ease-in-out;
-moz-transition: all 300ms ease-in-out;
-o-transition: all 300ms ease-in-out;
-ms-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
.wrapper-menu li:last-child{
margin-bottom: 0px;
}
.wrapper-menu li a{
text-align: left;
display: block;
width: 100%;
height: 100%;
color: #333;
position:relative;
}
.wrapper-icon{
font-family: 'WebSymbolsRegular', cursive;
font-size: 20px;
text-shadow: 0px 0px 1px #333;
line-height: 90px;
position: absolute;
width: 90px;
left: 20px;
text-align: center;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
}
.wrapper-content{
position: absolute;
left: 120px;
width: 370px;
height: 60px;
top: 20px;
}
.wrapper-main{
font-size: 30px;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
}
.wrapper-sub{
font-size: 14px;
color: #666;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
}
.wrapper-menu li:hover{
border-color: #fff004;
background: #cc0000;
}
.wrapper-menu li:hover .wrapper-icon{
color: #fff004;
text-shadow: 0px 0px 1px #fff004;
font-size: 50px;
}
.wrapper-menu li:hover .wrapper-main{
color: #fff004;
font-size: 14px;
}
.wrapper-menu li:hover .wrapper-sub{
color: #fff;
font-size: 30px;
}
Note:-The transform property supports all latest version of Safari 9+, Chrome 43+
, Firefox 16+, Opera 30+, and IE 10+.
0 Comment(s)