css教程:css指令,兼容,注释,selector
作者 佚名技术
来源 CSS技术
浏览
发布时间 2012-03-04
|
ot;>The most wonderful of all breakfast foods is
the waffle--a ridged and cratered slab of home-cooked, fluffy goodness...
</p>
这个style属性是一个新属性,可以用到出现body元素中的所有元素上。
可以看到style的值是一个字符串,使用和css一样的语法。
但是这个字符串只能是一个风格声明块declaration block。不能将@import和css
规则放到这个字符串中。就是说只能放css文档中出现在花括号中的文本。
注意:inline style不被推荐使用,在xhtml1.1中inline style是反对的
deprecated。因为,它显示违背数据和显示分离的原则。这个原则也是使用css的
原因。
2 selector
css核心的特点是将规则应用到元素集上的能力。
Css2规范种关于selector的部分,
http://www.w3.org/TR/REC-CSS2/selector.html
css的模式匹配pattern matching规则(css规范,地址如上):
Pattern
|
Meaning
|
Described in section
|
*
|
Matches any element.
|
Universal selector
|
E
|
Matches any E element (i.e., an element of type E).
|
Type selectors
|
E F
|
Matches any F element that is a descendant of an E element.
|
Descendant selectors
|
E > F
|
Matches any F element that is a child of an element E.
|
Child selectors
|
E:first-child
|
Matches element E when E is the first child of its parent.
|
The :first-child pseudo-class
|
E:link E:visited
|
Matches element E if E is the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited).
|
The link pseudo-classes
|
E:active E:hover E:focus
|
Matches E during certain user actions.
|
The dynamic pseudo-classes
|
E:lang(c)
|
Matches element of type E if it is in (human) language c (the document language specifies how language is determined).
|
The :lang() pseudo-class
|
E + F
|
Matches any F element immediately preceded by an element E.
|
Adjacent selectors
|
E[foo]
|
Matches any E element with the "foo" attribute set (whatever the value).
|
Attribute selectors
|
E[foo="warning"]
|
Matches any E element whose "foo" attribute value is exactly equal to "warning".
|
Attribute selectors
|
E[foo~="warning"]
|
Matches any E element whose "foo" attribute value is a list of space-separated values, one of which is exactly equal to "warning".
|
Attribute selectors
|
E[lang|="en"]
|
Matches any E element whose "lang" attribute has a hyphen-separated list of values beginning (from the left) with "en".
|
Attribute selectors
|
DIV.warning
|
HTML only. The same as DIV[class~="warning"].
|
Class selectors
|
E#myid
|
Matches any E element ID equal to "myid".
|
ID selectors
|
|
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn
为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
|