css3圆形多层缩放特效
![CSS3 Metal menu with icons CSS3 Metal menu with icons](https://i-blog.csdnimg.cn/blog_migrate/6c82dd6ba83493b5fe5b818a141a7ea4.png)
![带图标CSS3金属菜单 CSS3 Metal menu with icons](https://i-blog.csdnimg.cn/blog_migrate/6c82dd6ba83493b5fe5b818a141a7ea4.png)
CSS3 Metal menu with icons. In our new tutorial we’ll create a beautiful CSS3 menu with icons in metal style. This is will pretty standard UL-LI multilevel menu.
带图标CSS3 Metal菜单。 在我们的新教程中,我们将创建一个带有金属风格图标的漂亮CSS3菜单。 这是相当标准的UL-LI多级菜单。
Here are final result (what we will creating):
这是最终结果(我们将创建的结果):
![css3 menu11](https://i-blog.csdnimg.cn/blog_migrate/73b0cba38aea9210dd97e207a0bf3514.png)
![CSS3菜单11](https://i-blog.csdnimg.cn/blog_migrate/73b0cba38aea9210dd97e207a0bf3514.png)
Here are samples and downloadable package:
以下是示例和可下载的软件包:
现场演示
[sociallocker]
[社交储物柜]
打包下载
[/sociallocker]
[/ sociallocker]
Ok, download the example files and lets start coding !
好的,下载示例文件并开始编码!
步骤1. HTML (Step 1. HTML)
As usual, we start with the HTML. Here are full html code of our menu. As you can see – this is multilevel menu. Whole menu built on UL-LI elements.
和往常一样,我们从HTML开始。 这是菜单的完整html代码。 如您所见–这是多级菜单。 整个菜单均基于UL-LI元素。
index.html (index.html)
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<title>CSS3 Metal menu with icons | Script Tutorials</title>
<link rel="stylesheet" href="css/layout.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/menu.css" type="text/css" media="screen">
</head>
<body>
<div class="container">
<ul id="nav">
<li><a href="#"><img src="images/home.png" /> Home</a></li>
<li><a href="#"><span><img src="images/top1.png" /> HTML/CSS</span></a>
<div class="subs">
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 1</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 2</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 3</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 4</a></li>
<li><a href="#"><span><img src="images/top3.png" /> Sublinks</span></a>
<div class="subs">
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 41</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 42</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 43</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 44</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 45</a></li>
</ul>
</div>
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 46</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 47</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 48</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 49</a></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 6</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 7</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 8</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 9</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 10</a></li>
</ul>
</div>
</div>
</li>
<li><a href="#"><span><img src="images/top2.png" /> jQuery/JS</span></a>
<div class="subs">
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 1</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 2</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 3</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 4</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 5</a></li>
</ul>
</div>
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 6</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 7</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 8</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 9</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 10</a></li>
</ul>
</div>
</div>
</li>
<li><a href="#"><img src="images/top3.png" /> PHP</a></li>
<li><a href="#"><img src="images/top4.png" /> MySQL</a></li>
<li><a href="#"><img src="images/top5.png" /> XSLT</a></li>
</ul>
</div>
<footer>
<h2>CSS3 Metal menu with icons</h2>
<a href="https://www.script-tutorials.com/css3-metal-menu-with-icons" class="stuts">Back to original tutorial on <span>Script Tutorials</span></a>
</footer>
</body>
</html>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8" />
<title>CSS3 Metal menu with icons | Script Tutorials</title>
<link rel="stylesheet" href="css/layout.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/menu.css" type="text/css" media="screen">
</head>
<body>
<div class="container">
<ul id="nav">
<li><a href="#"><img src="images/home.png" /> Home</a></li>
<li><a href="#"><span><img src="images/top1.png" /> HTML/CSS</span></a>
<div class="subs">
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 1</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 2</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 3</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 4</a></li>
<li><a href="#"><span><img src="images/top3.png" /> Sublinks</span></a>
<div class="subs">
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 41</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 42</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 43</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 44</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 45</a></li>
</ul>
</div>
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 46</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 47</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 48</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 49</a></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 6</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 7</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 8</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 9</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 10</a></li>
</ul>
</div>
</div>
</li>
<li><a href="#"><span><img src="images/top2.png" /> jQuery/JS</span></a>
<div class="subs">
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 1</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 2</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 3</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 4</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 5</a></li>
</ul>
</div>
<div class="col">
<ul>
<li><a href="#"><img src="images/bub.png" /> Link 6</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 7</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 8</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 9</a></li>
<li><a href="#"><img src="images/bub.png" /> Link 10</a></li>
</ul>
</div>
</div>
</li>
<li><a href="#"><img src="images/top3.png" /> PHP</a></li>
<li><a href="#"><img src="images/top4.png" /> MySQL</a></li>
<li><a href="#"><img src="images/top5.png" /> XSLT</a></li>
</ul>
</div>
<footer>
<h2>CSS3 Metal menu with icons</h2>
<a href="https://www.script-tutorials.com/css3-metal-menu-with-icons" class="stuts">Back to original tutorial on <span>Script Tutorials</span></a>
</footer>
</body>
</html>
步骤2. CSS (Step 2. CSS)
Here are the CSS styles of our menu. Maybe you’ve noticed – that in our html – I have two CSS files: layout.css and menu.css. The first file (layout.css) contain the styles of our test page. We will not publish these styles in this article, but if you wish – you can find these styles in the package.
这是菜单CSS样式。 也许您已经注意到-在我们的html中-我有两个CSS文件:layout.css和menu.css。 第一个文件(layout.css)包含测试页的样式。 我们不会在本文中发布这些样式,但是如果您愿意–您可以在包中找到这些样式。
css / menu.css (css/menu.css)
ul#nav {
display:block;
float:left;
font-family:Trebuchet MS,sans-serif;
font-size:0;
padding:5px 5px 5px 0;
background: -moz-linear-gradient(#f5f5f5, #c4c4c4); /* FF 3.6+ */
background: -ms-linear-gradient(#f5f5f5, #c4c4c4); /* IE10 */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(100%, #c4c4c4)); /* Safari 4+, Chrome 2+ */
background: -webkit-linear-gradient(#f5f5f5, #c4c4c4); /* Safari 5.1+, Chrome 10+ */
background: -o-linear-gradient(#f5f5f5, #c4c4c4); /* Opera 11.10 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#c4c4c4'); /* IE6 & IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#c4c4c4')"; /* IE8+ */
background: linear-gradient(#f5f5f5, #c4c4c4); /* the standard */
}
ul#nav,ul#nav ul {
list-style:none;
margin:0;
}
ul#nav,ul#nav .subs {
background-color:#444;
border:1px solid #454545;
border-radius:9px;
-moz-border-radius:9px;
-webkit-border-radius:9px;
}
ul#nav .subs {
background-color:#fff;
border:2px solid #222;
display:none;
float:left;
left:0;
padding:0 6px 6px;
position:absolute;
top:100%;
width:300px;
border-radius:7px;
-moz-border-radius:7px;
-webkit-border-radius:7px;
}
ul#nav li:hover>* {
display:block;
}
ul#nav li:hover {
position:relative;
}
ul#nav ul .subs {
left:100%;
position:absolute;
top:0;
}
ul#nav ul {
padding:0 5px 5px;
}
ul#nav .col {
float:left;
width:50%;
}
ul#nav li {
display:block;
float:left;
font-size:0;
white-space:nowrap;
}
ul#nav>li,ul#nav li {
margin:0 0 0 5px;
}
ul#nav ul>li {
margin:5px 0 0;
}
ul#nav a:active,ul#nav a:focus {
outline-style:none;
}
ul#nav a {
border-style:none;
border-width:0;
color:#181818;
cursor:pointer;
display:block;
font-size:13px;
font-weight:bold;
padding:8px 18px;
text-align:left;
text-decoration:none;
text-shadow:#fff 0 1px 1px;
vertical-align:middle;
}
ul#nav ul li {
float:none;
margin:6px 0 0;
}
ul#nav ul a {
background-color:#fff;
border-color:#efefef;
border-style:solid;
border-width:0 0 1px;
color:#000;
font-size:11px;
padding:4px;
text-align:left;
text-decoration:none;
text-shadow:#fff 0 0 0;
border-radius:0;
-moz-border-radius:0;
-webkit-border-radius:0;
}
ul#nav li:hover>a {
border-style:none;
color:#fff;
font-size:13px;
font-weight:bold;
text-decoration:none;
text-shadow:#181818 0 1px 1px;
}
ul#nav img {
border:none;
margin-right:8px;
vertical-align:middle;
}
ul#nav span {
background-position:right center;
background-repeat:no-repeat;
display:block;
overflow:visible;
padding-right:0;
}
ul#nav ul span {
background-image:url("../images/arrow.png");
padding-right:20px;
}
ul#nav ul li:hover>a {
border-color:#444;
border-style:solid;
color:#444;
font-size:11px;
text-decoration:none;
text-shadow:#fff 0 0 0;
}
ul#nav > li >a {
background-color:transpa;
height:25px;
line-height:25px;
border-radius:11px;
-moz-border-radius:11px;
-webkit-border-radius:11px;
}
ul#nav > li:hover > a {
background-color:#313638;
line-height:25px;
}
ul#nav {
display:block;
float:left;
font-family:Trebuchet MS,sans-serif;
font-size:0;
padding:5px 5px 5px 0;
background: -moz-linear-gradient(#f5f5f5, #c4c4c4); /* FF 3.6+ */
background: -ms-linear-gradient(#f5f5f5, #c4c4c4); /* IE10 */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(100%, #c4c4c4)); /* Safari 4+, Chrome 2+ */
background: -webkit-linear-gradient(#f5f5f5, #c4c4c4); /* Safari 5.1+, Chrome 10+ */
background: -o-linear-gradient(#f5f5f5, #c4c4c4); /* Opera 11.10 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#c4c4c4'); /* IE6 & IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#c4c4c4')"; /* IE8+ */
background: linear-gradient(#f5f5f5, #c4c4c4); /* the standard */
}
ul#nav,ul#nav ul {
list-style:none;
margin:0;
}
ul#nav,ul#nav .subs {
background-color:#444;
border:1px solid #454545;
border-radius:9px;
-moz-border-radius:9px;
-webkit-border-radius:9px;
}
ul#nav .subs {
background-color:#fff;
border:2px solid #222;
display:none;
float:left;
left:0;
padding:0 6px 6px;
position:absolute;
top:100%;
width:300px;
border-radius:7px;
-moz-border-radius:7px;
-webkit-border-radius:7px;
}
ul#nav li:hover>* {
display:block;
}
ul#nav li:hover {
position:relative;
}
ul#nav ul .subs {
left:100%;
position:absolute;
top:0;
}
ul#nav ul {
padding:0 5px 5px;
}
ul#nav .col {
float:left;
width:50%;
}
ul#nav li {
display:block;
float:left;
font-size:0;
white-space:nowrap;
}
ul#nav>li,ul#nav li {
margin:0 0 0 5px;
}
ul#nav ul>li {
margin:5px 0 0;
}
ul#nav a:active,ul#nav a:focus {
outline-style:none;
}
ul#nav a {
border-style:none;
border-width:0;
color:#181818;
cursor:pointer;
display:block;
font-size:13px;
font-weight:bold;
padding:8px 18px;
text-align:left;
text-decoration:none;
text-shadow:#fff 0 1px 1px;
vertical-align:middle;
}
ul#nav ul li {
float:none;
margin:6px 0 0;
}
ul#nav ul a {
background-color:#fff;
border-color:#efefef;
border-style:solid;
border-width:0 0 1px;
color:#000;
font-size:11px;
padding:4px;
text-align:left;
text-decoration:none;
text-shadow:#fff 0 0 0;
border-radius:0;
-moz-border-radius:0;
-webkit-border-radius:0;
}
ul#nav li:hover>a {
border-style:none;
color:#fff;
font-size:13px;
font-weight:bold;
text-decoration:none;
text-shadow:#181818 0 1px 1px;
}
ul#nav img {
border:none;
margin-right:8px;
vertical-align:middle;
}
ul#nav span {
background-position:right center;
background-repeat:no-repeat;
display:block;
overflow:visible;
padding-right:0;
}
ul#nav ul span {
background-image:url("../images/arrow.png");
padding-right:20px;
}
ul#nav ul li:hover>a {
border-color:#444;
border-style:solid;
color:#444;
font-size:11px;
text-decoration:none;
text-shadow:#fff 0 0 0;
}
ul#nav > li >a {
background-color:transpa;
height:25px;
line-height:25px;
border-radius:11px;
-moz-border-radius:11px;
-webkit-border-radius:11px;
}
ul#nav > li:hover > a {
background-color:#313638;
line-height:25px;
}
现场演示
结论 (Conclusion)
Hope you enjoyed with new menu, don’t forget to tell thanks and leave a comment :) Good luck!
希望您喜欢新菜单,别忘了感谢并发表评论:)祝您好运!
翻译自: https://www.script-tutorials.com/css3-metal-menu-with-icons/
css3圆形多层缩放特效