澳门鸿运国际,让你建站更便捷和轻松!
您当前的位置:鸿运娱乐 > 网页制作 > CSS教程
案例详述常用的div ul li css样式
来源:澳门鸿运国际  时间:2010-02-02 09:58:13

相信很多人在用div+ul+li+css样式来定义导航和栏目,今天我们通过网易网的案例来学习一下UL-LI样式的三种形式。
<STYLE type=text/css>
BODY {
FONT-SIZE: 12px;FONT-FAMILY: "宋体", arial
}
.menu {
CLEAR: both; OVERFLOW: hidden; HEIGHT: 22px
}
.menu LI {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 2px; CURSOR: pointer; PADDING-TOP: 6px; LIST-STYLE-TYPE: none
}
.menu .active {
BACKGROUND: url(); FLOAT: left; WIDTH: 146px; TEXT-ALIGN: center
}
.menu .normal {
BACKGROUND: url(); FLOAT: left; WIDTH: 145px; TEXT-ALIGN: center
}


#navlist {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; MARGIN: 5px 0px 0px; FONT: bold 12px Verdana, sans-serif; PADDING-TOP: 3px; BORDER-BOTTOM: #778 1px solid
}
#navlist LI {
DISPLAY: inline; MARGIN: 0px; LIST-STYLE-TYPE: none
}
#navlist LI A {
BORDER-RIGHT: #778 1px solid; PADDING-RIGHT: 0.5em; BORDER-TOP: #778 1px solid; PADDING-LEFT: 0.5em; BACKGROUND: #dde; PADDING-BOTTOM: 3px; MARGIN-LEFT: 3px; BORDER-LEFT: #778 1px solid; PADDING-TOP: 3px; BORDER-BOTTOM: #778 1px; TEXT-DECORATION: none
}
#navlist LI A:link {
COLOR: #448
}
#navlist LI A:visited {
COLOR: #667
}
#navlist LI A:hover {
BORDER-LEFT-COLOR: #227; BACKGROUND: #aae; BORDER-BOTTOM-COLOR: #227; COLOR: #000; BORDER-TOP-COLOR: #227; BORDER-RIGHT-COLOR: #227
}
#navlist LI A#current {
BACKGROUND: #fbfbfb; BORDER-BOTTOM: #fbfbfb 1px solid
}


#topAD {
BORDER-RIGHT: #cccbc9 1px solid; BORDER-TOP: #cccbc9 1px solid; MARGIN-BOTTOM: 7px; OVERFLOW: hidden; BORDER-LEFT: #cccbc9 1px solid; WIDTH: 748px; LINE-HEIGHT: 20px; BORDER-BOTTOM: #cccbc9 1px solid; HEIGHT: 185px
}
.topADTabs {
FLOAT: left; WIDTH: 22px; COLOR: #494d50; PADDING-TOP: 1px
}
.topADTabs UL {
BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; BORDER-RIGHT-WIDTH: 0px;LIST-STYLE-TYPE: none
}
.topADTabs LI {
BORDER-RIGHT: #fff 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #fff 1px; PADDING-LEFT: 0px; BACKGROUND: #e7edf9; PADDING-BOTTOM: 0px; VERTICAL-ALIGN: middle; BORDER-LEFT: #fff 1px; WIDTH: 18px; CURSOR: pointer; LINE-HEIGHT: 15px; PADDING-TOP: 9px; BORDER-BOTTOM: #fff 1px solid; HEIGHT: 36px; TEXT-ALIGN: center; FONT-SIZE: 12px
}
.topADTabs .topADTabsOn {
PADDING-RIGHT: 0px; PADDING-LEFT: 3px; BACKGROUND: url() no-repeat; PADDING-BOTTOM: 0px; BORDER-LEFT: #fff 1px solid; WIDTH: 19px; CURSOR: pointer; PADDING-TOP: 9px; TEXT-ALIGN: left
}
</STYLE>

<DIV class="menu">
<UL>
<LI class=active>体育</LI>
<LI class=normal>NBA·姚明</LI>
<LI class=normal>奥运</LI></UL>
</DIV>

<br><br>

<UL id=navlist>
      <LI><A href="mingpian.asp">我的鸿运娱乐</A>
      <LI><A id=current href="mingpian1.asp">我的名片</A>
   <LI><A href="Folder.asp">我的分类</A>
      <LI><A href="mingpian2.asp">我的信箱</A>     
      <LI><A href="mingpian3.asp">我的积分</A>
      <LI><A href="mingpian4.asp">我的设置</A>
</UL>

<br><br>

<DIV id=topAD>
<SCRIPT language=javascript type=text/javascript>
function Show_topADMenu(topadid_num,topadnum){
for(var i=0;i<4;i++){document.getElementById("topadcontent_"+topadid_num+i).style.display="none";}
for(var i=0;i<4;i++){document.getElementById("topadmenu_"+topadid_num+i).className="";}
document.getElementById("topadmenu_"+topadid_num+topadnum).className="topADTabsOn";
document.getElementById("topadcontent_"+topadid_num+topadnum).style.display="block";
}
</SCRIPT>

<DIV class=topADTabs>
<UL>
<LI class=topADTabsOn id=topadmenu_10 onmouseover="setTimeout('Show_topADMenu(1,0)',200);">热销 </LI>
<LI id=topadmenu_11 onMouseOver="setTimeout('Show_topADMenu(1,1)',200);">上海
</LI>
<LI id=topadmenu_12 onMouseOver="setTimeout('Show_topADMenu(1,2)',200);">广东
</LI>
<LI id=topadmenu_13 onMouseOver="setTimeout('Show_topADMenu(1,3)',200);">加盟
</LI>
</UL>
</DIV>

<DIV id=topadcontent_10>
1
</DIV>

<DIV id=topadcontent_11 style="DISPLAY: none">
2
</DIV>

<DIV id=topadcontent_12 style="DISPLAY: none">
3
</DIV>

<DIV id=topadcontent_13 style="DISPLAY: none">
4
</DIV>
</DIV>
以上例子很经典,喜欢的朋友可以收藏,有不明白的可以加
 

责任编辑:admin

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
CopyRight 2008-2009, favnav.com, Inc. All Rights Reserved
皖ICP备09015033号