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>
  • 相关阅读:
    c# 对文件操作
    c# 获取当前绝对路径
    c# 过滤特殊字符
    c# txt代码转换成HTML格式
    c# 对象集合转Json
    c# DataReader转换为Json
    c# DataSet转换为Json
    ABAP-SAP的LUW和DB的LUW的区别
    ABAP-关于隐式与显式的DB Commit
    ABAP-Keyword Documentation
  • 原文地址:https://www.cnblogs.com/tyb1222/p/4185101.html
Copyright © 2011-2022 走看看