CSS to achieve the first character to sink

Principle: After the floating elements, the floating subsequent content will not clear surrounds the floating element. 

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        p {
            width: 200px;
            margin: 0 auto;
        }

        p::first-line {
            text-transform: uppercase;
        }

        p::first-letter {
            font-size: 3em;
            float: left;
        }
    </style>
</head>

<body>

<p>fasdfasdfadfasdfsdfa fasdfasdfasdf sdfasdfsadf</p>
</body>
</html>

 

Guess you like

Origin blog.csdn.net/github_38108899/article/details/86689300