1、網頁側邊欄導航
給你個思路,做個div固定那個位置,然後添加圖片超鏈接!
2、在網頁上增加一個側邊欄
sdf
3、HTML5設計一個導航側邊欄?
使用公式(an+ b).描述抄:a代表一個循環的大小,N是一個計數器(從0開始),以及b是偏移量。
p:nth-of-type(2n+0)
{
background:red;
}
p:nth-of-type(2n+1)
{
background:blue;
}
4、網頁導航欄的設計方式有哪些
導航欄的設計方式有很多種,通過專業的PS設計軟體,可以結合自己的靈感設計,網上有很多可以做為參考或欣賞。
5、HTML使用DIV+CSS如何實現左邊導航,右邊顯示內容,點擊那個導航顯示那個內容
1、新建html文檔。
2、書寫hmtl代碼。
<ul>
<li><A class="hover" href="#">前端交流</A></li>
<li><A href="#">交互設計</A></li>
<li><A href="#">視覺設計</A></li>
<li><A href="#">用戶研究</A></li>
<li><A href="#">設計茶吧</A></li>
<li><A href="#">前端交流</A></li>
<li><A href="#">團隊生活</A></li>
<div id="lanPos"></div>
</ul>
3、書寫css代碼。
<style>
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; font-weight: normal; }
body { line-height: 1; }
:focus { outline: 1; }
article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { display: block; }
nav ul, ul, li { list-style: none; }
blockquote, q { quotes: none; }
blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; }
a { margin: 0; padding: 0; border: 0; font-size: 100%; vertical-align: baseline; background: transparent; text-decoration: none; }
a:hover { text-decoration: underline; }
ins { background-color: #ff9; color: #000; text-decoration: none; }
mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
del { text-decoration: line-through; }
abbr[title], dfn[title] { border-bottom: 1px dotted #000; cursor: help; }
table { border-collapse: collapse; border-spacing: 0; }
hr { display: block; height: 1px; border: 0; border-top: 1px solid #cccccc; margin: 1em 0; padding: 0; }
input, select { vertical-align: middle; }
.fl { float: left; display: inline-block; }
.fr { float: right; display: inline-block; }
.clearfix:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
.clearfix { display: inline-table; }
* html .clearfix { height: 1%; }
.clearfix { display: block; }
html { font-size: 62.5%; /* 10÷16=62.5% */ }
body { font-size: 12px; font-size: 1.2rem; background: #F8F8F8; font-family: "宋體"; }
ul { width: 180px; margin: 0 auto; background: #fff; position: relative; z-index: 0; padding: 60px 20px 70px; }
ul li { height: 40px; line-height: 40px; text-align: center; border-bottom: 1px solid #F8F8F8; }
ul li a { color: #666; display: block; }
ul li a:hover { color: #FF5F3E; text-decoration: none; }
ul li a.hover { color: #FF5F3E; }
#lanPos { width: 225px; height: 40px; line-height: 40px; background: #F8F8F8; border-left: 5px solid #FF5F3E; position: absolute; left: -5px; top: 0; z-index: -1; transition: top .2s; }
</style>
4、書寫並引用js代碼。
<script src="js/jquery.min.js"></script>
<script>
$(function(){
$('#lanPos').css('top',$('.hover').offset().top);
$('ul li').hover(function(){
$('#lanPos').css('top',$(this).offset().top);
},function(){
$('#lanPos').css('top',$('.hover').offset().top);
})
$('ul li').click(function(){
for(var i=0;i<$('ul li').size();i++){
if(this==$('ul li').get(i)){
$('ul li').eq(i).children('a').addClass('hover');
}else{
$('ul li').eq(i).children('a').removeClass('hover');
}
}
})
})
</script>
5、代碼整體結構。
6、查看效果
6、html文件,實現上方導航和左側邊欄不變,而右側邊欄信息變換?是用框架嗎
用框架可以做:
1.建立主頁面,就是你打開就能看到的頁面
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>網頁標題</title>
</head>
<frameset rows="16%,84%"border="0">
<frame noresize src="top.htm" scrolling="no">
<frameset cols="25%,*" >
<frame scrolling="no" noresize src="left.htm">
<frame name="rgt" src="right.htm">
</frameset>
</frameset>
<noframes></noframes>
</html>這裡面top.htm就是上方導航,left.htm就是左側信息,right.htm就是右側信息
2.建立頂部頁面top.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>無標題文檔</title>
</head>
<body>
<table width=50% align=center>
<tr align=center>
<td width=50%><a target="rgt" href="right.htm">導航1</a></td>
<td width=50%><a target="rgt" href="right2.htm">導航2</a></td>
</tr>
</table>
</body>
</html>
這里要注意target="rgt",rgt是我們在第一步里right.htm的name,也就是說點擊這里,右邊的內容會跳轉到指定的頁面,也就實現了右邊信息的變換
這里我只寫兩個,你自己在導航里改,凡是有鏈接的你都加上target="rgt"
3.建立左部頁面left.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>無標題文檔</title>
</head>
<body>
<a href="right.htm" target="rgt">右部信息1</a>
<br><br>
<a href="right2.htm" target="rgt">右部信息2</a>
</body>
</html>
這里同樣,凡是有鏈接的你都加上target="rgt",點擊後右邊內容會隨之變換
4.建立右部信息頁面right.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>無標題文檔</title>
</head>
<body>
<table>
<tr>
<td valign="top" width="500" height="1000">
<h3 align="center">右邊信息</h3>
</td>
</tr>
</table>
</body>
</html>
這里是打開主頁面後看到的右邊部分的內容
5.建立右邊部分等待切換的頁面right2.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>無標題文檔</title>
</head>
<body>
<table>
<tr>
<td valign="top" width="500" height="1000">
<h3 align="center">右邊信息二</h3>
</td>
</tr>
</table>
</body>
</html>
注意這個right2.htm在top.htm和left.htm里都出現過
也就是說點擊它們就會將右邊內容切換到相應頁面
我這里只做了兩個,如果多的話就繼續做right3.htm之類
OK完成
7、網頁側邊欄這個效果是怎麼實現的?
懸浮按鈕
相對於窗口來定位,因為位置一直固定在窗口的一個位置,所以看著像懸浮
position設置為fixed,再用top,left,right,bottom等屬性定位
8、網頁設計如何打出這個框架?尤其是「側邊欄+主體框」?勞煩大神幫打一下!謝謝!
首先等一個網頁的寬度,然後再寫css樣式。直接給你實例代碼吧:
<style>