first-letter和first-line的区别

1.first-letter和first-line都作用于块级元;

2.first-letter:作用于第一行的首字符;

3.first-line:作用于第一行的所有字符;

 1 <!DOCTYPE html>
 2 <html>
 3 
 4     <head>
 5         <meta charset="{CHARSET}">
 6         <title></title>
 7     </head>
 8     <style>
 9        .parent {
10             height: 500px;
11             border: 1px solid #222;
12             display: flex;
13         }
14         
15         .left {
16             width: 200px;
17             border: 1px solid #ccc;
18             margin: 20px;
19             height: 200px;
20         }
21         
22         .left::first-letter{
23             color:red;
24             font-size: 24px;
25         }
26         .right {
27             border: 1px solid #ff4400;
28             margin:20px;
29             height: 200px;
30             flex: 1;
31         }
32         .right::first-line{
33             color:red;
34             font-size: 24px;
35         }
36     </style>
37 
38     <body>
39         <div class="parent">
40             <div class="left">
41                 <p>qwewwerwerwerer</p>
42             </div>
43             <div class="right">
44                 <p>dspojdiohudf</p>
45             </div>
46         </div>
47     </body>
48 
49 </html>

first-letter和first-line的区别

上一篇:题解 CF43B 【Letter】


下一篇:文本美化