How to use first-letter in CSS
This article mainly introduces the relevant knowledge of how to use first-letter in CSS, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to use first-letter in CSS. Let's take a look at it.
First-letter is written as follows
P:first-letter {
/ * describe the CSS style you want to apply * /
}
This is the block element specified by p.
It points to
The p of the label, if you want to apply the tag, you can change it to H2.
Let's take a look at specific examples.
The code is as follows
HTML code
First-letter
CSS code
Sample.css
P:first-letter {
Color:#5bc0de
Font-size:300%
}
Running result
Display the effect shown below on the browser
First-letter
P is followed by ":" (colon), not "."
If you just make a mistake, this will not apply at all, so be careful.
And, as mentioned earlier, p is a block element. Block elements refer to
The p of the label, if you want to apply it to, just change it to H2.
The CSS style we wrote in {}. In other words, just write a style that you most want to apply to the first character.
This is the end of the article on "how to use first-letter in CSS". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use first-letter in CSS". If you want to learn more, you are welcome to follow the industry information channel.