IE兼容
只在IE下生效
<!--[if IE]>
这段文字只在IE浏览器显示
<![endif]-->;
只在IE6下生效
<!--[if IE 6]>
这段文字只在IE6浏览器显示
<![endif]-->;
只在IE6以上版本生效
<!--[if gte IE 6]>
这段文字只在IE6以上(包括)版本IE浏览器显示
<![endif]-->;
只在IE8上不生效
<!--[if ! IE 8]>
这段文字在非IE8浏览器显示
<![endif]-->;
非IE浏览器生效
<!--[if !IE]>
这段文字只在非IE浏览器显示
<![endif]-->;
CSS3选择器
.class 例:.intro 选择 class="intro" 的所有元素。
id 例:#firstname 选择 id="firstname" 的所有元素。
* 选择所有元素。
element 例p 选择所有 <p> 元素。
element,element 例div,p 选择所有 <div> 元素和所有 <p> 元素。
element element 例div p 选择 <div> 元素内部的所有 <p> 元素。
element>element 例div>p 选择父元素为 <div> 元素的所有 <p> 元素。
element+element 例div+p 选择紧接在 <div> 元素之后的所有 <p> 元素。
[attribute] 例[target] 选择带有 target 属性所有元素。
[attribute=value] 例[target=_blank] 选择 target="_blank" 的所有元素。
[attribute~=value] 例[title~=flower] 选择 title 属性包含单词 "flower" 的所有元素。
[attribute|=value] 例[lang|=en] 选择 lang 属性值以 "en" 开头的所有元素。
:link 例a:link选择所有未被访问的链接。
:visited 例a:visited 选择所有已被访问的链接。
:active 例a:active 选择活动链接。
:hover 例a:hover 选择鼠标指针位于其上的链接。
:focus 例input:focus 选择获得焦点的 input 元素。
:first-letter 例p:first-letter 选择每个 <p> 元素的首字母。
:first-line 例p:first-line 选择每个 <p> 元素的首行。
:first-child 例p:first-child 选择属于父元素的第一个子元素的每个 <p> 元素。
:before 例p:before 在每个 <p> 元素的内容之前插入内容。
:after 例p:after 在每个 <p> 元素的内容之后插入内容。
:lang(language) 例p:lang(it) 选择带有以 "it" 开头的 lang 属性值的每个 <p> 元素。
element1~element2 例p~ul 选择前面有 <p> 元素的每个 <ul> 元素。
[attribute^=value] 例a[src^="https"] 选择其 src 属性值以 "https" 开头的每个 <a> 元素。
[attribute$=value] 例a[src$=".pdf"] 选择其 src 属性以 ".pdf" 结尾的所有 <a> 元素。
[attribute*=value] 例a[src*="abc"] 选择其 src 属性中包含 "abc" 子串的每个 <a> 元素。
:first-of-type 例p:first-of-type 选择属于其父元素的首个 <p> 元素的每个 <p> 元素。
:last-of-type 例p:last-of-type 选择属于其父元素的最后 <p> 元素的每个 <p> 元素。
:only-of-type 例p:only-of-type 选择属于其父元素唯一的 <p> 元素的每个 <p> 元素。
:only-child 例p:only-child 选择属于其父元素的唯一子元素的每个 <p> 元素。
:nth-child(n) 例p:nth-child(2) 选择属于其父元素的第二个子元素的每个 <p> 元素。
:nth-last-child(n) 例p:nth-last-child(2) 同上,从最后一个子元素开始计数。
:nth-of-type(n) 例p:nth-of-type(2) 选择属于其父元素第二个 <p> 元素的每个 <p> 元素。
:nth-last-of-type(n) 例p:nth-last-of-type(2) 同上,但是从最后一个子元素开始计数。
:last-child 例p:last-child 选择属于其父元素最后一个子元素每个 <p> 元素。
:root 例:root 选择文档的根元素。
:empty 例p:empty 选择没有子元素的每个 <p> 元素(包括文本节点)。
:target 例#news:target 选择当前活动的 #news 元素。
:enabled 例input:enabled 选择每个启用的 <input> 元素。
:disabled 例input:disabled 选择每个禁用的 <input> 元素
:checked 例input:checked 选择每个被选中的 <input> 元素。
:not(selector) 例:not(p) 选择非 <p> 元素的每个元素。
::selection 例::selection 选择被用户选取的元素部分。