CSS学习笔记-CSS属性(五)

来源:互联网 发布:highcharts 3d.js 编辑:程序博客网 时间:2024/05/09 22:28

CSS属性——尺寸属性

属性 值 含义
height
auto:自动,浏览器会自动计算高度
length:使用px定义高度
%:基于包含它的块级对象的百分比高度 设置元素高度
width 同上 设置元素的宽度

CSS属性——字体属性

属性名 值 含义
font-family
宋体、黑体等 设置文字字体

font-size
12px、14px 设置字符大小

font-style
normail(正常)、(itlic)斜体 设置字体样式

font-weight
normal、bold、bolder、lighter 设置文字粗细

font
设置文字各种属性的简捷方式
Font可以同时设置字符的各种属性,包括font-style、font-weight、font-size、line-height、font-family。各属性间用空格隔开。如果同时设置font-size和line-height,这两属性值间以“/”隔开。

font{ italic bold 12px/20px arial,sans-serif; }

CSS属性——文本属性

属性 值 含义
color #ff0000或red或rgb(3,5,8) 设置文本颜色

line-height 正整数或百分比 设置行高

letter-spacing 正整数或负值 字符间距

text-align left、center、right 对齐方式

vertical-align Top、middle、bottom、baseline等
当前元素与相邻元素的垂直对齐关系。

text-transform Capitalize、uppercase 、lowercase 大小写转换

text-indent %或像素 首行文本缩进

text-decoration none、underline,、overline 、line-through 文本的修饰

word-spacing normal、length 单词间距

p{ text-decoration: underline overline line-through;}   //同时设置多线

CSS属性——伪类属性

属性 含义
:link 向未被访问的链接添加样式。
:visited 向已被访问的链接添加样式。
:hover 当鼠标悬浮在元素上方时,向元素添加样式。

CSS属性——列表属性

属性 值 含义
list-style square inside url(arrow.gif) 在一个声明中设置所有列表属性

list-style-image url(图像路径) 将图象设置为列表项标记。

list-style-position inside, outside 设置列表项标记的放置位置。

list-style-type none,disc,square,circle 设置列表项标记的类型。

CSS属性——表格属性

属性 值 含义
border-collapse
separate(默认), collapse(合并) 是否合并表格边框

border-spacing
length length 或 length 相邻单元格边框之间的距离
如果设置一个值,水平和垂直一样;如果设置两个值,水平和垂直分开设置

caption-side
top 或 bottom 规定表格标题的位置

CSS属性——背景属性

属性 值 含义
background-color #ff0000、red、rgb(255,0,0) 背景颜色

background-image
url(图像路径和名称); 背景图像

background-repeat
repeat、repeat-x、repeat-y、 no-repeat 背景图像是否重复

Background-position
center center或x% y%或xpos ypos 背景图像起始位置

background-attachment
scroll或fixed 设置背景图像是固定还是滚动
background
url(1.jpg) no-repeat center center 设置背景的简写形式

CSS属性——边框属性

属性 值 含义
border border:1px solid #444444; 设置所有边框属性

border-top 设置顶边框属性

border-right 设置右边框属性

border-bottom 设置底边框属性

border-left 设置左边框属性
边框线型
none:无 solid(实线) dotted(点状线) dashed(虚线) double(双线) groove(3D 凹槽边框)

0 0
原创粉丝点击