常用Css样式
/*标题元素*/
h1,h2,h3,h4,h5,h6 {
color: green;
}
/*父元素继承*/
body {
font-family: Verdana, sans-serif;
}
/*id 选择器*/
#red {color:red;}
/*id 选择器和派生选择器*/
#red p {
font-style: italic;
text-align: right;
margin-top: 0.5em;
}
/*类选择器*/
.center {text-align: center}
/*属性*/
/*背景*/
background-color: gray;
background-image:url(../image/topmiddle.jpg);
background-repeat:no-repeat;
/*文字*/
text-align:left;
font-size:11px;
font-family:黑体;
line-height:25px;*行间距*/
text-indent:16px;/*文字缩近*/
letter-spacing ;/*文字之间的间隔*/
word-spacing ;/*单词之间的间隔*/
/*外边距*/
margin-top:5px;
/*内边距*/
padding-bottom:30px;
/*边框*/
border-color:#e1e0e0;
border-style:solid;
border-width:0px 1px 1px 1px;
/*浮动*/
float: left;
/*绝对定位*/
#box_relative {
position: absolute;
left: 30px;
top: 20px;
}
/*相对定位*/
#box_relative {
position: relative;
left: 30px;
top: 20px;
}
相关文档:
Internet Explorer 8预设是以CSS 2.1为标准,并修正了许多Internet Explorer 7的CSS Bug,这意味着有一部份以往依据IE 7所设计的网页,
在IE 8上的呈现会有所出入,所幸拜IE 7相容检视功能所赐,目前因使用IE 8而导致版面错误的网站并不多。
但一值依赖IE 7相容检视功能并非长久之计,尽早将网站修改为IE 8相容才是长久 ......
盒子标签和属性对照
CSS语法(不区分大小写)
JavaScript语法(区分大小写)
border
border
border-bottom
borderBottom
border-bottom-color
borderBottomColor
border-bottom-style
borderBottomStyle
border-bottom-width
borderBottomWidth
border-color
borderColor
border-left
borderLeft
border ......
text-overflow : ellipsis;
white-space : nowrap;
overflow : hidden;
解释一下:
text-overflow :ellipsis; //让截断的文字显示为点点。还有一个值是clip意思是截断不显示点点
white-space : nowrap; //让文字不换行
overflow : hidden; //超出要隐藏
要显示为点点,3个缺一不可,还有,除了firefox,opera其他浏 ......
TABLE{
BORDER-RIGHT: #888 1px solid;
BORDER-TOP: #888 1px solid;
MARGIN-TOP: 10px;
BORDER-LEFT: #888 1px solid;
WIDTH: 100%;
BORDER-BOTTOM: #888 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
BORDER-COLLAPSE: collapse;
}
TABLE PRE {
BORDER-TOP-WIDTH: 0px;
PADDING-RIGHT: 0px;
PA ......
当在做项目时,通常我们会大量的使用母版页,使用母版页的好处显而易见,但通常在内容页中嵌套母版页时,我们还要在内容页中调用css样式和 javascript函数,好处有了,问题也来了。有两种解决方法,第一种就是在母版页的头部<head></head>标记中,嵌入所有css样式和javascript函数,这样做使得母版页的内容非常 ......