css学习一

css:叠层样式表

在哪写:

1.内联、(行内) 写在标签里面

以属性的形式表现 属性名style

2.内嵌:写在head标签里面 标签名style

3.外部引用写在标签里面,以属性的形式表现 属性名style

<link=" ">

给谁用

  选择器:找标签

  格式:选择器{样式}

  通用选择器:*

  标签选择器:标签名

  id选择器:#id值

  class选择器: .class值

  其他:

    并列选择器:选择器1 ,选择器2{ }

    后代选择器:选择器1    选择器2{ }

    属性选择器:选择器[属性名=‘属性值’]

先用谁

  优先级 相同选择器  相同样式  后面覆盖前面

  权值  权值越大  优先级越高

  行内 1000

  id   100

  class  10

  标签  1

  通用  0

比如

.class值{

中间编辑属性

}

 .zhaomu{

width: 600px;

height: 70px;

 }  

猜你喜欢

转载自www.cnblogs.com/zhangzongke/p/10952393.html