纯css实现蓝色圆角效果水平导航菜单代码
网站建设 2021-07-03 08:15www.dzhlxh.cn网站建设
本文实例讲述了纯css实现蓝色圆角效果水平导航菜单代码。分享给大家供大家参考。具体如下:
这是一款可爱的蓝色圆角水平导航菜单,用到几张背景图片,我觉得这款菜单挺实用,特别是用在个人博客中非常合适。在兼容性方面做的也很好,几乎兼容所有的浏览器。
运行效果截图如下:
在线演示地址如下:
具体代码如下:
复制代码
代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>蓝色圆角水平导航菜单</title>
<style>
*{
margin:0;
padding:0;
}
body{
background:#fff;
color:#666;
font:12px/18px Tahoma, Arial, Helvetica, sans-serif;
}
#menu{
width:100%;
margin:15px;
}
#menu ul{
list-style:none;
}
#menu li{
list-style:none;
display:block;
float:left;
margin:0 2px;
}
#menu li a{
display:block;
float:left;
height:66px;
color:#fff;
text-transform:uppercase;
font-size:11px;
font-weight:bold;
background:url(images/menu_009_l.jpg) no-repeat left;
line-height:66px;
padding:0 0 0 9px;
text-decoration:none;
}
#menu li a span{
display:block;
float:left;
background:url(images/menu_009_r.jpg) no-repeat right;
height:66px;
color:#d2eeff;
line-height:66px;
padding:0 18px 0 8px;
}
#menu li a:hover{
display:block;
float:left;
background:url(images/menu_009_h_l.jpg) no-repeat left;
height:66px;
}
#menu li a:hover span{
display:block;
float:left;
background:url(images/menu_009_h_r.jpg) no-repeat right;
color:#fff;
height:66px;
}
#menu li a.current{
display:block;
float:left;
height:66px;
color:#fff;
text-transform:uppercase;
font-size:11px;
font-weight:bold;
background:url(images/menu_009_h_l.jpg) no-repeat left;
line-height:66px;
padding:0 0 0 9px;
text-decoration:none;
}
#menu li a.current span{
display:block;
float:left;
background:url(images/menu_009_h_r.jpg) no-repeat right;
height:66px;
color:#fff;
line-height:66px;
padding:0 18px 0 8px;
}
</style>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#" class="current"><span>首页</span></a></li>
<li><a href="#"><span>精品脚本下载</span></a></li>
<li><a href="#"><span>网页模板</span></a></li>
</ul>
</div>
</body>
</html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>蓝色圆角水平导航菜单</title>
<style>
*{
margin:0;
padding:0;
}
body{
background:#fff;
color:#666;
font:12px/18px Tahoma, Arial, Helvetica, sans-serif;
}
#menu{
width:100%;
margin:15px;
}
#menu ul{
list-style:none;
}
#menu li{
list-style:none;
display:block;
float:left;
margin:0 2px;
}
#menu li a{
display:block;
float:left;
height:66px;
color:#fff;
text-transform:uppercase;
font-size:11px;
font-weight:bold;
background:url(images/menu_009_l.jpg) no-repeat left;
line-height:66px;
padding:0 0 0 9px;
text-decoration:none;
}
#menu li a span{
display:block;
float:left;
background:url(images/menu_009_r.jpg) no-repeat right;
height:66px;
color:#d2eeff;
line-height:66px;
padding:0 18px 0 8px;
}
#menu li a:hover{
display:block;
float:left;
background:url(images/menu_009_h_l.jpg) no-repeat left;
height:66px;
}
#menu li a:hover span{
display:block;
float:left;
background:url(images/menu_009_h_r.jpg) no-repeat right;
color:#fff;
height:66px;
}
#menu li a.current{
display:block;
float:left;
height:66px;
color:#fff;
text-transform:uppercase;
font-size:11px;
font-weight:bold;
background:url(images/menu_009_h_l.jpg) no-repeat left;
line-height:66px;
padding:0 0 0 9px;
text-decoration:none;
}
#menu li a.current span{
display:block;
float:left;
background:url(images/menu_009_h_r.jpg) no-repeat right;
height:66px;
color:#fff;
line-height:66px;
padding:0 18px 0 8px;
}
</style>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#" class="current"><span>首页</span></a></li>
<li><a href="#"><span>精品脚本下载</span></a></li>
<li><a href="#"><span>网页模板</span></a></li>
</ul>
</div>
</body>
</html>
希望本文所述对大家的div+css网页设计有所帮助。