What are the pseudo-classes and pseudo-elements in CSS? What is the use? (with code)

藏色散人
Release: 2018-10-22 17:15:54
original
4846 people have browsed it

This article mainly introduces to you a summary of the usage of pseudo-classes and pseudo-elements in css.

css, also known as cascading style sheets, can not only statically modify web pages, but also dynamically format various elements of web pages in conjunction with various scripting languages.

So what are the css pseudo-classes and pseudo-elements? what's the function?

What are the pseudo-classes and pseudo-elements in CSS? What is the use? (with code)

CSS pseudo-classes are used to add special effects to certain selectors. CSS pseudo-elements are used to set special effects to certain selectors.

Let’s summarize the css pseudo-classes and pseudo-elements.

Pseudo class:


:active, adds styles to activated elements.

:focus, adds style to the selected element.

:hover, when the mouse is hovering over the element, add a style to the element.

:link, add special styles to unvisited links.

:visited, adds special styles to visited links.

:first-child, adds special styles to the first child element of the element.

:lang, allows the author to define the language used in the specified element.

Pseudo-element:

:first-letter, adds a special style to the first letter of the text.

:first-line, adds a special style to the first line of text.

:before, insert some content before an element.

:after, insert some content after an element.

This article is a summary of CSS pseudo-classes and pseudo-elements. I hope it will be helpful to friends in need!

If you want to know more about front-end related knowledge, you can follow the PHP Chinese website

CSS video tutorial, Bootstrap tutorial and other related tutorials. Welcome everyone to refer to and learn!

The above is the detailed content of What are the pseudo-classes and pseudo-elements in CSS? What is the use? (with code). For more information, please follow other related articles on the PHP Chinese website!

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 [email protected]
Latest issues
Popular Tutorials
More>
Latest downloads
More>
web effects
Website source code
Website materials
Front end template
About us Disclaimer Sitemap
PHP Chinese website:Public welfare online PHP training,Help PHP learners grow quickly!