29 lines
716 B
Markdown
29 lines
716 B
Markdown
|
---
|
||
|
title: First-Line
|
||
|
---
|
||
|
## First-Line
|
||
|
|
||
|
The ```::first-line``` CSS pseudo-element styles the first line of a selected HTML element.
|
||
|
|
||
|
General Syntax:
|
||
|
|
||
|
```css
|
||
|
::first-line
|
||
|
```
|
||
|
|
||
|
## Example
|
||
|
|
||
|
```css
|
||
|
/* "First line of every paragraph is set to bold*/
|
||
|
p::first-line {
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
```
|
||
|
|
||
|
The ```::first-line``` CSS pseudo-element is often paired with the ```::first-letter``` CSS pseudo-element for a drop caps effect emphasizing the first letter and line of a paragraph.
|
||
|
|
||
|
#### More Information:
|
||
|
* [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-line)
|
||
|
* [W3 Schools](https://www.w3schools.com/cssref/sel_firstline.asp)
|
||
|
* [CSS Tricks](https://css-tricks.com/almanac/selectors/f/first-line/)
|