zoukankan      html  css  js  c++  java
  • 伪类

    1、链接伪类:

    :link

    :visited

    2、动态伪类(可应用到任何元素)

    :focus

    :hover

    :active

    伪类顺序很重要;通常建议:link-visited-focus-hover-active

    3、静态伪类

    :first-child(第一个此类元素)

     p:first-child { font-weight: bold; }
    
                li:first-child { text-transform: uppercase; }
    
    
            <p>there are not </p> <!--起作用-->
            <p>there are not </p> <!--不起作用-->
            <p>there are not </p> <!--不起作用-->
            <p>there are not </p> <!--不起作用-->
            <div>
                <p>there are</p> <!--起作用-->
                <p>there are</p>
                <ul>
                    <li>key</li> <!--起作用-->
                    <li>key</li> <!--不起作用-->
                    <li>key</li> <!--不起作用-->
                </ul>
                <p>do <em>not</em> push</p>
            </div>
            <div>
                <div>
                    <p>other div</p> <!--起作用-->
                    <p>other div</p> <!--不起作用-->
                    <p>other div</p><!--不起作用-->
                </div>
                
            </div>

     3、伪类元素选择器,设置首字母样式

    h1:first-letter {
                    color: red;
                    font-size: 200%;
                } 
    <h1>first</h1>

    设置第一行样式。

    :first-line

    所有伪元素都必须出现在该伪元素的最后面。如p:first-letter em就不合法

    4、设置之前或之后的元素

    h2:before {
                    content: "}}";color: red;
                }
    <h2>first</h2>
  • 相关阅读:
    HDOJ 1241 Oil Deposits【最大连通块 dfs】
    POJ 3984 迷宫问题【迷宫最短路径 bfs】
    封装
    继承的另一种使用方式。。。
    类的绑定方法与继承
    XML模块与类的定义
    常用模块三
    python day19
    常用模块与项目目录规范
    python day17
  • 原文地址:https://www.cnblogs.com/tyb1222/p/4185101.html
Copyright © 2011-2022 走看看