首页 > 代码库 > 标准的CSS代码编写习惯:两列左导航设计,顶
标准的CSS代码编写习惯:两列左导航设计,顶
/***********************************************/
/* 2col_leftNav.css */
/* Use with template 2col_leftNav.html */
/***********************************************/
/***********************************************/
/* HTML tag styles 整体考虑 */
/***********************************************/
body{
font-family: Arial,sans-serif;
color: #333333;
line-height: 1.166;
margin: 0px;
padding: 0px;
}
a:link, a:visited, a:hover {
color: #006699;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* overrides decoration from previous rule for hovered links */
h1, h2, h3, h4, h5, h6 {
font-family: Arial,sans-serif;
margin: 0px;
padding: 0px;
}
h1{
font-family: Verdana,Arial,sans-serif;
font-size: 120%;
color: #334d55;
}
h2{
font-size: 114%;
color: #006699;
}
h3{
font-size: 100%;
color: #334d55;
}
h4{
font-size: 100%;
font-weight: normal;
color: #333333;
}
h5{
font-size: 100%;
color: #334d55;
}
ul{
list-style-type: square;
}
ul ul{
list-style-type: disc;
}
ul ul ul{
list-style-type: none;
}
label{
font: bold 100% Arial,sans-serif;
color: #334d55;
}
/***********************************************/
/* Layout Divs 布局考虑 */
/***********************************************/
#masthead{
margin: 0;
padding: 10px 0px;
border-bottom: 1px solid #cccccc;
width: 100%;
}
#navBar{
margin: 0 79% 0 0;
padding: 0px;
#eeeeee;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
#content{
float:right;
width: 75%;
margin: 0;
padding: 0 3% 0 0;
}
/***********************************************/
/*Component Divs 中间件或组件、组成部分考虑 */
/***********************************************/
#siteName{
margin: 0px;
padding: 0px 0px 10px 10px;
}
/*************** #pageName styles **************/
#pageName{
padding: 0px 0px 10px 10px;
}
/************* #globalNav styles **************/
#globalNav{
color: #cccccc;
padding: 0px 0px 0px 10px;
white-space: nowrap;
}
/* ‘nowrap‘ prevents links from line-wrapping if there are too many to fit in one line
this will force a horizontal scrollbar if there isn‘t enough room for all links
remove rule or change value to ‘normal‘ if you want the links to line-wrap */
#globalNav img{
display: block;
}
#globalNav a {
font-size: 90%;
padding: 0px 4px 0px 0px;
}
/************* #breadCrumb styles *************/
#breadCrumb{
font-size: 80%;
padding: 5px 0px 5px 10px;
}
/************** .feature styles ***************/
.feature{
padding: 0px 0px 10px 10px;
font-size: 80%;
}
.feature h3{
padding: 30px 0px 5px 0px;
text-align: center;
}
.feature img{
float: left;
padding: 0px 10px 0px 0px;
margin: 0 5px 5px 0;
}
/* adjust margins to change separation between the feature image and text flowing around it */
/************** .story styles *****************/
.story{
clear: both;
padding: 10px 0px 0px 10px;
font-size: 80%;
}
.story p{
padding: 0px 0px 10px 0px;
}
/************* #siteInfo styles ***************/
#siteInfo{
clear: both;
border: 1px solid #cccccc;
font-size: 75%;
color: #cccccc;
padding: 10px 10px 10px 10px;
margin-top: 0px;
}
/* negative top margin pulls siteinfo up so its top border overlaps (and thus lines up with)
the bottom border of the navBar in cases where they "touch" */
#siteInfo img{
padding: 4px 4px 4px 0px;
vertical-align: middle;
}
/************* #search styles ***************/
#search{
padding: 5px 0px 5px 10px;
border-bottom: 1px solid #cccccc;
font-size: 90%;
}
#search form{
margin: 0px;
padding: 0px;
}
#search label{
display: block;
margin: 0px;
padding: 0px;
}
/*********** #navBar link styles ***********/
#navBar ul a:link, #navBar ul a:visited {display: block;}
#navBar ul {list-style: none; margin: 0; padding: 0;}
/* hack to fix IE/Win‘s broken rendering of block-level anchors in lists */
#navBar li {border-bottom: 1px solid #EEE;}
/* fix for browsers that don‘t need the hack */
html>body #navBar li {border-bottom: none;}
/*********** #sectionLinks styles ***********/
#sectionLinks{
position: relative;
margin: 0px;
padding: 0px;
border-bottom: 1px solid #cccccc;
font-size: 90%;
}
#sectionLinks h3{
padding: 10px 0px 2px 10px;
}
#sectionLinks a:link{
padding: 2px 0px 2px 10px;
border-top: 1px solid #cccccc;
width: 100%;
voice-family: "\"}\"";
voice-family:inherit;
width: auto;
}
#sectionLinks a:visited{
border-top: 1px solid #cccccc;
padding: 2px 0px 2px 10px;
}
#sectionLinks a:hover{
border-top: 1px solid #cccccc;
#dddddd;
padding: 2px 0px 2px 10px;
}
/*********** .relatedLinks styles ***********/
.relatedLinks{
margin: 0px;
padding: 0px 0px 10px 10px;
font-size: 90%;
}
.relatedLinks h3{
padding: 10px 0px 2px 0px;
}
/************** #advert styles **************/
#advert{
padding: 10px 0px 0px 10px;
font-size: 80%;
border-top: 1px solid #cccccc;
}
#advert img{
display: block;
}
/************** #headlines styles **************/
#headlines{
margin: 0px;
padding: 10px 0px 20px 10px;
font-size: 80%;
}
#headlines p{
padding: 5px 0px 5px 0px;
}
标准的CSS代码编写习惯:两列左导航设计,顶