Home >Web Front-end >CSS Tutorial >The first summary of common css attributes: id and class selectors

The first summary of common css attributes: id and class selectors

高洛峰
高洛峰Original
2017-02-23 09:43:342027browse

Speaking of selectors, everyone is familiar with them. It is estimated that the most commonly used ones are the id selector and the class selector. As for other selectors, I will avoid talking about them here today.

Class selector: Give the html element a loud name and mark it with class, then you can use the class selector, such as

It is paragraph 1

. Here I set the p element class
to "p1", and then write the css style to use it directly,

For example:


p.p1{color:red;}




This paragraph will also be center-aligned.



Statement:
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