1.属性选择符: eg.1)所有包含alt属性的图像都将会有一个灰色的边框

img[alt]?{

border:1px ?dotted #999;

}

happysnail

2)包含title属性的链接将是红色

a[title]{ color:#C00; } <a href=”https://www.weixing.me“ ?title=”happysnail” >happysnail

2、子对象选择符 eg. 这个规则将设置所有属于

元素子对象的链接的样式

div > a { text-indent :-9999px; }

只有div 的直接 子对象a 才会有 text-indent 的属性,而

  • 下的a将不会有text-indent效果 3、相邻选择符 eg.只有snail是红色的

    h2+p { color:#C00; }

    happy

    snail

    .org

    4、伪类和伪对象 1) 只有第一个P有效果

    I'm the first child

    I'm the second child

    news.p:first-child{ font-size:200%; }

    2):focus将应用于那些获得焦点的对象

    input[type=text]:focus{ color:#000; background:#ffc; }

    3)p的第一行和第一个字母的效果

    p:first-line { font:##C00; } p:first-letter { font-size:400%; font-weight:bolid; }