color :设置文本颜色; background-color:定义了元素的背景颜色 .body {background-color:#b0c4de;} background-image:元素的背景图像.body {background-image:url('paper.gif');} background-repeat:设置定位于不平铺background-repeat:no-repeat; background-position:改变图像在背景中的位置background-position:right top; "background":合并在同一个属性中:#ffffff url('img_tree.png') no-repeat right top; text-align:center设置文本的水平对齐方式 text-align:right居中或对齐到左或右,两端对齐 text-align:justify每一行被展开为宽度相等,左,右外边距是对齐p.main {text-align:justify;} text-decoration: 用来设置或删除文本的装饰a {text-decoration:none;}无样式 {text-decoration:overline;}顶线 text-decoration:line-through中线 text-decoration:underline文本下线 文本转换 p.uppercase {text-transform:uppercase;}大写 p.lowercase {text-transform:lowercase;}小写 p.capitalize {text-transform:capitalize;}首字母大写 text-indent:指定文本的第一行的缩进p {text-indent:50px;} 字体系列:font-family 属性设置文本的字体系列,font-family 属性应该设置几个字体名称作为一种"后备"机制,如果浏览器不支持第一种字体,他将尝试下一种字体,p{font-family:"Times New Roman", Times, serif;}后面的为后备字体; 字体样式:font-style,主要是用于指定斜体文字的字体样式属性,p.normal {font-style:normal;}正常显示文本 p.italic {font-style:italic;}以斜体字显示的文字 p.oblique {font-style:oblique;}文字向一边倾斜 设置小型大写字母的字体显示文本,font-variant 属性 p.normal {font-variant:normal;}正常显示文本,font-variant:small-caps;设置为小型大写字母字体 设置不同的字体粗细 font-weight属性 p.normal {font-weight:normal;}正常文本 p.thick {font-weight:bold;}定义粗体字符 p.thicker {font-weight:lighter;}定义更细的字符 p.thicker {font-weight:900;}数字定义文本由粗到细的字符,400等于默认值,700等同于粗体; 字体大小:font-size 单位:px 链接的样式,可以用任何CSS属性(如颜色,字体,背景等,不同的链接可以有不同的样式。 a:link {color:#000000;}a:link - 正常,未访问过的链接 a:visited {color:#00FF00;} a:visited - 用户已访问过的链接 a:hover {color:#FF00FF;}当用户鼠标放在链接上时 a:active {color:#0000FF;} 链接被点击的那一刻 当设置为若干链路状态的样式,也有一些顺序规则:a:hover 必须跟在 a:link 和 a:visited后面,a:active 必须跟在 a:hover后面 链接样式自动删除添加下划线:a:link {text-decoration:none;}正常状态下没有显示下划线 a:visited {text-decoration:none;} 访问过的链接也不显示下划线;a:hover {text-decoration:underline;}当鼠标放到链接上面显示下划线 a:active {text-decoration:underline;}鼠标点击链接显示下划线 列表:无序列表 - 列表项标记用特殊图形(如小黑点、小方框等) 无序列表:ul.a {list-style-type:circle;} ;ul.b {list-style-type:square;} 有序列表:ol.c {list-style-type:upper-roman;} ;ol.d {list-style-type:lower-alpha;}ol.d {list-style-type:digital;} 定列表项标记的图像,使用列表样式图像属性:list-style-image:url('') 表格:使用css可以使HTML网页中的表格更美观; 使用border属性,改变一个表格边框的大小,颜色,实虚线,border:1px solid red; border-collapse 属性设置表格的边框是否被折叠成一个单一的边框或隔开; Width和height属性定义表格的宽度和高度%,px 表格中的文本对齐和垂直对齐属性:text-align,设置水平对齐方式,向左,右,或中心 text-align:aleft 表格填充:表的内容中控制空格之间的边框(占中控位置),padding(px) 控制表格颜色:background-color,border:1px solid green |