css样式大总结1

背景样式
1.background-color 属性定义了元素的背景颜色. body{background-color:#b0c4de;}
2.background-image 属性描述了元素的背景图像. body {background-image:url('paper.gif');}
3.background-repeat属性描述了背景图的平铺.
body
{
background-image:url('gradient2.png');
background-repeat:repeat-x;//水平方向平铺
}
body
{
background-image:url('gradient2.png');
background-repeat:repeat-y;//垂直方向平铺
}
body
{
background-image:url('img_tree.png');
background-repeat:no-repeat;//不平铺
}
4. background-position 属性改变图像在背景中的位置 
body
{
background-image:url('img_tree.png');
background-repeat:no-repeat;
background-position:right top;
}
背景简写属性
body {background:#ffffff url('img_tree.png') no-repeat right top;}


当使用简写属性时,属性值的顺序为::
background-color
background-image
background-repeat
background-attachment //背景图像是否固定或者随着页面的其余部分滚动。
background-position




文本
1.文本对齐方式。text-align 描述的是文本的对齐方式.当text-align设置为"justify",每一行被展开为宽度相等,左,右外边距是对齐(如杂志和报)
h1 {text-align:center;}
p.date {text-align:right;}
p.main {text-align:justify;}
2.文本修饰。text-decoration 属性用来设置或删除文本的装饰。从设计的角度看 text-decoration属性主要是用来删除链接的下划线:
a {text-decoration:none;} //删除线
h1 {text-decoration:overline;} //线在字体上部
h2 {text-decoration:line-through;}//线穿过字
h3 {text-decoration:underline;}//线在下部
3.文本转换。文本转换属性是用来指定在一个文本中的大写和小写字母。
可用于所有字句变成大写或小写字母,或每个单词的首字母大写。
text-transform:uppercase;//全部转换成大写
text-transform:lowercase;//全部转换成小写
text-transform:capitalize;//每个单词的首字母大写开头


属性        描述
color        设置文本颜色
direction 设置文本方向。
letter-spacing 设置字符间距
line-height 设置行高
text-align 对齐元素中的文本
text-decoration 向文本添加修饰
text-indent 缩进元素中文本的首行
text-shadow 设置文本阴影
text-transform 控制元素中的字母
unicode-bidi 设置或返回文本是否被重写 
vertical-align 设置元素的垂直对齐
white-space 设置元素中空白的处理方式
word-spacing 设置字间距

猜你喜欢

转载自blog.csdn.net/cgt_0812/article/details/72884649