1. 程式人生 > 其它 >CSS3----偽元素和偽類選擇器----偽元素選擇器

CSS3----偽元素和偽類選擇器----偽元素選擇器

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
            /* div{
                height: 200px;
                background: #BBFFAA;
            }
            div:empty{
                background: red;
            } 
*/ /* .wrap::after{ content: ""; display: block; width: 200px; height: 200px; background-color: #BBFFAA; } */ .wrap{ width: 500px; height
: 200px; margin: 0 auto; text-align: center; } .wrap::first-letter{ color: red; font-size: 3.125rem; font-weight: bold; } .wrap p::selection{ background-color:
red; } </style> </head> <body> <!-- <div></div> <div>scond</div> <div></div> <div>third</div> --> <div class="wrap"> <p>魯迅,原名周樹人</p> <p>你們找魯迅和我周樹人有什麼關係</p> </div> </body> </html>

::after
::before
::firstLetter
::firstLine
::selection 被選中的元素