What is the class selector in css3

青灯夜游
Release: 2022-03-11 19:02:12
Original
4643 people have browsed it

In CSS3, the class selector refers to the class selector, which allows you to specify styles in a way that is independent of document elements. It is used to describe the style of a group of elements and can be used in multiple elements. use. The class selector is represented by the class attribute in HTML and a dot "." in CSS.

What is the class selector in css3

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In CSS3, the class selector refers to the class selector, which is one of the most basic selectors.

The class selector allows you to specify styles in a way that is independent of document elements. It is used to describe the style of a group of elements and can be used in multiple elements.

The class selector is represented by the class attribute in HTML. In CSS, the class selector is displayed with a dot ".":

html code

<h1 class="center">标题居中</h1>
<p class="center">段落居中。</p>
Copy after login

CSS Code

.center{text-align:center;}
Copy after login

What is the class selector in css3

Note: Numbers cannot be used as the first character of the class name! It won't work in Mozilla or Firefox.

The class selector can be used alone or in combination with other selectors.

.fancy td {
	color: #f60;
	background: #666;
}
Copy after login

In the above example, the table cells inside the larger element with the class name fancy will display orange text on a gray background. (The larger element named fancy may be a table or a div)

td.fancy {
	color: #f60;
	background: #666;
}
Copy after login

In the above example, the table cell with class name fancy will be orange with a gray background.

(Learning video sharing: css video tutorial)

The above is the detailed content of What is the class selector in css3. 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 admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template