CSS導(dǎo)航欄及彈窗示例代碼
發(fā)布時(shí)間:2017-01-10 08:56:23 作者:Andone_hsx
我要評論
本篇文章主要介紹了CSS導(dǎo)航欄及彈窗示例代碼,導(dǎo)航欄和彈窗是在web中應(yīng)用很廣泛的,非常具有實(shí)用價(jià)值,需要的朋友可以參考下。
最近整理了CSS導(dǎo)航欄及彈窗,具體如下:
CSS導(dǎo)航
先來看下效果:

<!doctype html>
<html>
<head>
<title>Insert your title</title>
<meta charset="utf-8">
<style>
body{
font-size:12px;
}
#discuss{
width:990px;
margin:0 auto;
}
#mt{
/*高度:30px,邊框,上邊框,背景顏色*/
height:30px;
border:1px solid #ddd;
border-top:2px solid #9d9d9d;
background:#F7F7F7;
}
#discuss-content{
border-bottom:1px solid #ddd;
padding-bottom:2px;
}
#discuss-datas{
width:990px;
}
#discuss-datas thead td{
/*加粗,上下內(nèi)邊距,下邊框,文本居中對齊*/
font-weight:bold;
padding:5px 0;
border-bottom:1px solid #ddd;
text-align:center;
color:#666;
}
/*處理 .col1 的樣式 (每行第一列的效果)*/
#discuss-datas td.col1{
width:620px;
text-align:left;
}
/*內(nèi)容行中所有的列*/
#discuss-datas tbody td{
/*虛線下邊框,上下內(nèi)邊距,文本水平居中對齊,文本顏色*/
border-bottom:1px dotted #ddd;
padding:5px 0;
text-align:center;
color:#9c9a9c;
}
/*處理所有超鏈接*/
#discuss a{
color:#005aa0;
text-decoration:none;
}
#discuss a:hover{
text-decoration:underline;
}
/*曬,論 兩幅圖*/
#discuss-datas b{
/*寬度,高度,背景屬性*/
padding-left:21px;
padding-bottom:2px;
padding-top:3px;
background-image:url(../Images/iconlist_1.png);
background-repeat:no-repeat;
margin-right:5px;
}
b.shai{
background-position:-110px -220px;
}
b.lun{
background-position:-152px -220px;
}
/*2017-01-09 浮動練習(xí)*/
#mt a{
float:left;
width:100px;
height:30px;
text-align:center;
line-height:30px;
}
#mt a.current{
/*左右上邊框,背景顏色,文本顏色*/
border:1px solid #ddd;
border-bottom:none;
border-top:2px solid #E4393C;
background-color:#fff;
color:#E4393C;
/*位置上調(diào):margin-top 給負(fù)值*/
margin-top:-6px;
height:35px;
line-height:35px;
}
#extra p{margin:0;}
/*方案1*/
/*#extra p.new{
float:left;
}
#extra p.total{
float:right;
}
#extra{
overflow:hidden;
}*/
/*方案2*/
#extra p.total{
float:right;
}
</style>
</head>
<body>
<!-- 練習(xí) -->
<!-- #discuss : width:990px -->
<div id="discuss">
<!-- 頁簽 #mt : height:30px; ,邊框,背景 -->
<div id="mt">
<a href="#">網(wǎng)友討論圈</a>
<a href="#" class="current">曬單帖</a>
<a href="#">討論帖</a>
<a href="#">圈子帖</a>
<a href="#">問答帖</a>
</div>
<!-- 內(nèi)容 #discuss-content : 下邊框 -->
<div id="discuss-content">
<!-- 表格 -->
<table id="discuss-datas">
<thead>
<tr>
<td class="col1">主題</td>
<td>回復(fù)/瀏覽</td>
<td>作者</td>
<td>時(shí)間</td>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">
<b class="shai"></b>
<a href="#">
好大一瓶,不錯
</a>
</td>
<td>0/0</td>
<td>
<a href="#">2001年冬天</a>
</td>
<td>
2011-11-11 11:11:11
</td>
</tr>
<tr>
<td class="col1">
<b class="lun"></b>
<a href="#">
好大一瓶,不錯
</a>
</td>
<td>0/0</td>
<td>
<a href="#">2001年冬天</a>
</td>
<td>
2011-11-11 11:11:11
</td>
</tr>
<tr>
<td class="col1">
<b class="shai"></b>
<a href="#">
好大一瓶,不錯
</a>
</td>
<td>0/0</td>
<td>
<a href="#">2001年冬天</a>
</td>
<td>
2011-11-11 11:11:11
</td>
</tr>
<tr>
<td class="col1">
<b class="lun"></b>
<a href="#">
好大一瓶,不錯
</a>
</td>
<td>0/0</td>
<td>
<a href="#">2001年冬天</a>
</td>
<td>
2011-11-11 11:11:11
</td>
</tr>
</tbody>
</table>
<!-- 其他內(nèi)容(略) -->
<div id="extra">
<p class="total">
共900個(gè)話題
<a href="#">瀏覽全部話題</a>
</p>
<p class="new">
有問題與其他用戶討論
<a href="#">[發(fā)表帖子]</a>
</p>
</div>
</div>
</div>
</body>
</html>
最后效果圖:

商城導(dǎo)航:

<!doctype html>
<html>
<head>
<title>Insert your title</title>
<meta charset="utf-8">
<style>
#nav{
/*寬度,高度,背景顏色,水平居中對齊*/
width:990px;
height:40px;
background-color:#E64346;
margin:0 auto;
}
#nav p{
/*取消默認(rèn)margin,寬度,高度,背景顏色*/
margin:0;
width:210px;
height:40px;
background-color:#CD2A2C;
}
#nav>p>a{
/*左浮動,高度,行高,文字:加粗,大小,顏色,取消下劃線*/
float:left;
height:40px;
line-height:40px;
font-weight:bold;
font-size:14px;
color:#fff;
text-decoration:none;
padding-left:15px;
}
#nav>p>b{
/*右浮動,寬度,高度,背景,位置*/
float:right;
width:20px;
height:20px;
background:url(../Images/iconlist_2.png) no-repeat -65px 0;
margin:10px 10px 0 0;
}
#nav>p{
float:left;
}
#nav>ul{
float:left;
margin:0;
padding:0;
list-style:none;
}
#nav>ul li{
float:left;
}
#nav>ul li a{
/*寬度,高度,行高,文本:水平居中,大小,顏色,下劃線,加粗*/
float:left;
width:100px;
height:40px;
line-height:40px;
text-align:center;
font-size:14px;
color:#fff;
text-decoration:none;
font-weight:bold;
}
#nav>ul li a:hover{
background-color:#BD2A2C;
}
#container{
width:990px;
min-height:200px;
margin:0 auto;
}
#cate_box{
margin:0;
padding:0;
list-style:none;
/*寬度,高度,背景顏色,左右下邊框*/
width:210px;
min-height:400px;
background-color:#FAFAFA;
border:2px solid #CD2A2C;
border-top:none;
box-sizing:border-box;
/*上內(nèi)邊距*/
padding-top:5px;
}
#cate_box>li{
/*左內(nèi)邊距,上下內(nèi)邊距,寬度,下邊框(白色)*/
padding:5px 0 5px 10px;
width:196px;
box-sizing:border-box;
border-bottom:1px solid #fff;
border-top:1px solid transparent;
}
#cate_box li:hover{
border-top-color:#ddd;
border-bottom-color:#ddd;
background-color:#fff;
}
#cate_box li>a{
color:#333;
text-decoration:none;
font-size:14px;
}
</style>
</head>
<body>
<nav id="nav">
<p>
<a href="#">全部商品分類</a>
<b></b>
</p>
<ul>
<li>
<a href="#">首頁</a>
</li>
<li>
<a href="#">服裝城</a>
</li>
<li>
<a href="#">食品</a>
</li>
<li>
<a href="#">團(tuán)購</a>
</li>
<li>
<a href="#">奪寶島</a>
</li>
<li>
<a href="#">閃購</a>
</li>
<li>
<a href="#">金融</a>
</li>
</ul>
</nav>
<div id="container">
<ul id="cate_box">
<li>
<a href="#">圖書、音像、數(shù)字商品</a>
</li>
<li>
<a href="#">家用電器</a>
</li>
</ul>
</div>
</body>
</html>
導(dǎo)航列表彈框效果:
初始狀態(tài):

鼠標(biāo)懸停時(shí):

<!doctype html>
<html>
<head>
<title>Insert your title</title>
<meta charset="utf-8">
<style>
#my_jd{
width:100px;
height:30px;
text-align:center;
line-height:30px;
border:1px solid #000;
background-color:#fff;
/*相對定位:配合 #menu 的絕對定位*/
position:relative;
cursor:pointer;
}
#menu{
width:400px;
height:100px;
background-color:#fff;
border:1px solid #000;
/*絕對定位*/
position:absolute;
top:30px;
left:-1px;
/*隱藏*/
display:none;
}
#my_jd:hover #menu{
display:block;
}
#my_jd:hover #line{
width:100px;
position:absolute;
border-top:1px solid #fff;
}
</style>
</head>
<body>
<div id="my_jd">
我的京東
<!-- 彈出菜單 -->
<div id="menu">
模擬我的京東彈出菜單
</div>
<div id="line"></div>
</div>
</body>
</html>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章

html+css+js實(shí)現(xiàn)導(dǎo)航欄滾動漸變效果
這篇文章主要介紹了html+css+js實(shí)現(xiàn)導(dǎo)航欄滾動漸變效果,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-01-28
這篇文章主要介紹了純CSS實(shí)現(xiàn)導(dǎo)航欄下劃線跟隨效果,本文圖文并茂實(shí)例代碼詳解,給大家介紹的非常詳細(xì),需要的朋友參考下吧2019-12-09html+css 實(shí)現(xiàn)簡易導(dǎo)航欄功能
這篇文章主要介紹了基于html+css 實(shí)現(xiàn)簡易導(dǎo)航欄功能,主要就是css(級聯(lián)樣式表)對html的內(nèi)容做格式化。具體內(nèi)容詳情大家跟隨小編一起通過本文學(xué)習(xí)吧2021-04-07
CSS中的導(dǎo)航欄和下拉菜單的實(shí)現(xiàn)
這篇文章主要介紹了CSS中的導(dǎo)航欄和下拉菜單的實(shí)現(xiàn)的相關(guān)資料,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-07-18
純CSS實(shí)現(xiàn)導(dǎo)航欄下劃線跟隨滑動效果
這篇文章主要介紹了純CSS實(shí)現(xiàn)導(dǎo)航欄下劃線跟隨滑動效果,需要的朋友可以參考下2018-03-29
這篇文章主要介紹了使用CSS制作立體導(dǎo)航欄的相關(guān)資料,需要的朋友可以參考下2017-10-16div+css實(shí)現(xiàn)帶箭頭的面包屑導(dǎo)航欄
本文主要介紹了制作漂亮美觀的帶箭頭的面包屑導(dǎo)航欄的示例代碼。具有很好的參考價(jià)值。下面跟著小編一起來看下吧2017-04-06純CSS實(shí)現(xiàn)導(dǎo)航欄Tab切換效果
CSS 的強(qiáng)大之處有的時(shí)候超乎我們的想象,Tab 切換,常規(guī)而言確實(shí)需要用到一定的腳本才能實(shí)現(xiàn)。下面看看如何使用純CSS實(shí)現(xiàn)導(dǎo)航欄Tab切換效果2016-10-13CSS利用偽元素實(shí)現(xiàn)導(dǎo)航欄斜線分隔
這篇文章主要介紹了CSS利用偽元素實(shí)現(xiàn)導(dǎo)航欄斜線分隔的相關(guān)資料2016-03-14- 本篇文章給大家分享基于html和CSS3制作簡單側(cè)邊導(dǎo)航欄,效果簡單大方,需要的朋友可以從參考下2016-02-25






