在程序开发中,标签ul与css样式实现菜单,也是经常用到的技巧,这里给大家介绍2个实例:
标签ul与css样式实现菜单特效实例1如下图所示:
文章插图
标签ul与css样式实现菜单特效实例1
menu1.html网页代码如下:
<!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" lang="gb2312" xml:lang="gb2312">
<head>
<title>标签ul与css样式实现菜单特效</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" type="text/css" href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"css.css" />
</head>
<body>
<div id="mymenu">
<ul>
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">首页
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">产品介绍
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">热门推荐
【标签ul与css样式实现菜单特效实例】<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">行业动态
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">加盟我们
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">联系我们
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"#" id="rightcorner">
</ul>
</div>
<br style="clear: left" />
</body>
</html>
css.css代码如下:
#mymenu{
border-top: 7px solid black;
margin: 0;
padding: 0;
}
#mymenu ul{
margin: 0;
margin-left: 15px;
float: left;
padding-left: 10px;
font: 12px 宋体;
background-color: black;
}
* html #mymenu ul{
margin-bottom: 1em;
margin-left: 7px;
}
#mymenu ul li{
display: inline;
}
#mymenu ul li a{
float: left;
color: white;
font-weight: ;
padding: 2px 11px 7px 7px;
text-decoration: none;
}
#mymenu ul li a:visited{
color: white;
}
#mymenu ul li a:hover, #mymenu ul li a#selected{
color: white;
background-color: darkred;
}
#mymenu ul li a#rightcorner{
padding-right: 0;
padding-left: 8px;
}
标签ul与css样式实现菜单特效实例2如下图所示:
文章插图
标签ul与css样式实现菜单特效实例2
<!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>标签ul与css样式实现菜单特效</title>
<style type="text/css">
*
{
font-size:13px;
font-weight:800;
text-decoration:none;
margin:0;
padding:0;
}
body
{
background:#ddd;
}
#menu
{
list-style-type: none;
border:1px solid #fff;
margin:50px auto;
width:770px;
height:30px;
overflow:hidden;
background:#000 url(a.png) 0 0 repeat-x;
}
#menu li
{
border-right:1px solid #fff;
float:left;
}
#menu li a
{
display:block;
text-align:center;
color:#fff;
line-height:30px;
padding:0 10px;
}
#menu li a:hover,#menu li.current
{
background:#fff url(b.png) 0 0 repeat-x;
}
</style>
</head>
<body>
<ul id="menu">
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="Index">首页
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="Produces">产品介绍
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="Hot">热门推荐
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">行业动态
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">加盟我们
<li><a href=https://www.isolves.com/it/cxkf/yy/CSS2/2019-11-22/"" title="">联系我们
推荐阅读
- 处理声音与画面的分离编辑,使用Camtasia
- 恒福,对话器与茶 共谋茶具行业未来
- 碎砾石与砾石的区别 碎石和砂砾石的区别
- 台鹿谷农会盼与永福台农创业园优势深度合作
- 梦见被坏人盯上与跟踪,害怕 梦见被坏人盯上与跟踪到家
- 如何认定是投资还是借款
- 稀土与茶叶中稀土限量标准
- 照山白功效与作用介绍
- 白头翁的功效与作用都有哪些
- 专家与你起探讨饮茶之妙处