css菜单导航
这是我在一个网站上看到的,CSS控制一个菜单,很经典实用
Css文件如下:css.css
@charset "UTF-8";
/* navigation.css
$Revision: 1.0 $
(c) 2008 Fortinet, Inc. All rights reserved.
*/
/* Navigation Styles ------------------------------------------- */
#wrapper
{
width:1000px;margin:0 auto;
}
#nav_bar {
clear: both;
background: url(./menu_bkrd.jpg) repeat-x;
height: 26px;
width: 100%;
}
#navigation {
padding: 0 0 0 10px;
}
#nav, #nav ul {
float: left;
list-style: none;
line-height: 1;
padding: 0 0 0 0; /* 0 0 0 0.5em; */
margin: 0; /* 0 0 1em 0; */
/* border: solid 1px #33FF00; /* (Green) remove this item after testing */
width:auto;
}
#nav a {
font: 11px/12px Tahoma, Arial, Helvetica, Verdana, sans-serif;
color: #6a737b;
display: block;
width: 150px; /* 6em; 3em; 10em -- 150px*/
text-decoration: none;
padding: 7px 10px 4px 6px; /* 0.5em 3.5em 0.2em .5em; 0.4em 0 0.2em 0; // 0.4em 2em 0.2em 2em; // 0.5em 2em; */
margin: 0px; /* 0.5em 2em; uncommented - fixes extra space on right for IE 0 0 0 1px */
/* border: solid 1px #FF0000; /* (Red) remove this item after testing */
}
#nav a.top_nav {
font: 12px Arial, Helvetica, sans-serif;
color: #6a737b;
text-align: center;
width: 90px;
margin: 0;
padding: 6px 0 4px 0;
text-decoration: none;
font-weight: bold;
white-space: nowrap; /* */
}
#nav a.nav_parent {
background: url(./rightarrow.gif) center right no-repeat;
/* white-space: nowrap; /* */
/* border: solid 1px #FFFF00; /* (yellow) remove this item after testing */
}
#nav li {
/*float: left;*/
padding: 0;
/* width: 150px; /* 7.5em; 10em; 12em 178px; this has no affect whatsoever */
/* border: solid 1px #FFFF00; /* (yellow) remove this item after testing */
}
#nav li.top_nav
相关文档:
dt 和dd中可以再加入 ol ul li和p,理解这些以后,在使用div布局的时候,会方便很多,其实w3c提供了很多元素辅助布局都是有它的用处的,而不尽是div。
块级元素div尽量少用,其实和table一样,嵌套越少越好,它也是会影响速度的!
ol 有序列表。
<ol>
<li>......</li>
<li>......</li& ......
由下往上的:
<div id="demo" onmouseover="ij=1" style="border:1px solid gray; overflow: hidden; height: 119px; width:211px " onmouseout="ij=0">
<div id="demo1">1<br />2br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>
可以是任何的HTML内容<br&g ......
1.div的垂直居中问题
vertical-align:middle;
将行距增加到和整个DIV一样高 line-height:200px;
然后插入文字,就垂直居中了。缺点是要控制内容不要换行。
2. margin加倍的问题
设置为float的div在ie下设置的margin会加倍。这是一个ie6都存在的bug。
解决方案 ......
5种方法立刻写出更好的CSS代码
引自:http://bbs.seuuo.com/thread-2625-1-3.html
当然,每个人都可以编写CSS代码,甚至你现在已经让它为你的项目工作了。但是CSS还可以更好吗?开始用这5个Tips改进你的CSS吧!
1.重置
首先,很认真的告诉你,总是要重置某些分类。无论你是使用 Eric Meyer Reset、YUI Reset或者你自己编 ......
几个css元素的简单解释 div ul dl dt oldiv,这个很常见,块级元素,div尽量少用,和table一样,嵌套越少越好
ol 有序列表。
<ol>
<li>……</li>
<li>……</li>
<li>……</li>
</ol>
表现为:
1……
2…& ......