原理: 元素浮动后,不清除浮动后续内容会环绕在浮动元素的周围.
<!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>