关于CSS常用的基础知识

来源:互联网 发布:中控iface702软件 编辑:程序博客网 时间:2024/06/16 20:42

一、CSS选择器

元素选择器   

ID选择器   #id名

CLASS选择器  .类名

全局选择器   *

关联选择器-后代元素选择器  slecter selecter

关联选择器-子元素选择器     selecter>selecter

组合选择器  两种基本选择器的组合

伪类选择器  love-hate

    :link

    :visited

    :hover

    :active

二、选择器的优先级

id>class>普通的标签(Tag)

组合选择器 id权重100  class权重10  Tag权重1

三、CSS文本属性

1、letter-spacing 字母间距

2、word-spacing 单词间距

3、text-decoration none/underline/overline/line-through

4、text-align         水平对齐方式  left/right/center

5、vertical-align    垂直对齐方式(基于文字的基线)baseline/bottom/top/middle/sub/sup/text-top/text-bottom

*如果前面写了一行文字,后面插了一张图片,可根据这个属性确定图片垂直上的位置。

对img设置vertical-align:middle,相对于前面的文字居中。

6、text-indent  首行缩进

7、line-height  行高   设置行高等于高,可以使一行文字垂直居中

8、font:[style/variant/weight]   size/line-height   family

四、CSS背景属性

background:color  image  repeat  position

五、CSS边框属性

border:width  style   color

六、CSS表格属性

1、table-layout  表格布局方式  auto/fixed

2、border-collapse合并单元格 separate/collapse

3、border-spacing 单元格合并

4、caption-side      表格标题位置top/bottom

5、empty-cells        没有内容的单元格是否隐藏  show/hide




原创粉丝点击