Home > Web Front-end > CSS Tutorial > CSS Advanced Tutorial Pseudo Elements

CSS Advanced Tutorial Pseudo Elements

黄舟
Release: 2016-12-14 16:46:38
Original
1545 people have browsed it

Pseudo elements suck selectors like pseudo classes, using the form selector:pseudoelement { property: value; }. There are four suckers.
First letter and first line
The first-letter pseudo-element is applied to the first letter of the element, and the first-line is the top line of the element. You could, for example, create a paragraph with a bold first line and drop cap, like this:
p:first-letter {
font-size: 3em; float: left;
}
p:first-line {
font-weight: bold;
}
before and after
before and after pseudo-elements and content attributes are used on both sides of the element to change things on both sides of the content without changing the HTML.
The value of the content attribute can be open-quote (open quotation marks), close-quote (closed brackets), no-open-quote (no open brackets), no-close-quote (no closed brackets), any character with quotation marks String or image, use url(imagename).
blockquote:before {
content: open-quote;
}
blockquote:after {
content: close-quote;
}
li:before {
content: "POW: "
}
p:before {
content: url(images/jam.jpg)
}
Attention
Sounds good, dunnit? Well, there are so many of them (ugh, sigh) that most users are not able to see the before and after effects because IE is obsessed with them. Lazy...

For more CSS advanced tutorial pseudo-element related articles, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template