::first-letter and ::first-line
The ::first-letter
and ::first-line
are used to style the first part of the text content of a block-level element. Specifically, ::first-letter
applies to the first letter of the first line, and the ::first-line
applies to the first line itself. It is important to mention that the "first line" can vary depending on the font family and size as well as the size of the screen and block-level element.
p::first-letter {
float: left;
margin: 5px 10px 0 0;
padding: 10px;
background-color: skyblue;
font-size: 3em;
line-height: 1;
}
p::first-line {
background-color: skyblue;
}