Home > Web Front-end > HTML Tutorial > Three common style selectors for CSS in HTML_HTML/Xhtml_Web page production

Three common style selectors for CSS in HTML_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:40:01
Original
1455 people have browsed it

1: Tag selector

The tag selector is effective for all tags with a certain tag. Here we take p as an example, that is, everything marked with p will have this style


Copy code
The code is as follows:


< head>

p{font:"宋体"; color:#FF0000}



What I am showing now is the tag selector


I am also using the tag selector


I am not modified by any selector




2: id selector , note that the id selector is unique, because only id="yy" has this style, and the ID of an element in a page must be unique, so . . . Do you know that the id selector starting with # is: id=""


Copy code
The code is as follows:


< head>

#yy{font:"宋体"; color:#FF0000}



What I am showing now is the id selector


I am not modified by the id selector


I am not modified by any selector




3: Class selector , the class selector starts with . Just put the class="" of the element to display this style. The usage is: class=""


Copy code
The code is as follows:


< head>

.yy{font:"宋体"; color:#FF0000}



What I am showing is the class selector


I am not modified by the class selector


I am not modified by any selector




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