Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does css select a label

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to select tags for css". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how css selects tags".

Css to select the tag method: 1, the use of id selector, syntax for "# id name {css code;}"; 2, the use of class selector, syntax for ". Class name {css code;}"; 3, the use of tag selector, syntax for "* {css code;}".

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

How does css select the tag?

There are four ways to select tags in css, which are also four selectors.

1. Id selector

According to the specified id name, find the corresponding unique tag in the current interface, and then set the property

# id name {attribute: value;} id selector # p1 {color: red;} # p2 {color: green;} # p3 {color: blue;} most people are handsome, floating on the surface and handsome in appearance

And EGON is not only handsome on the outside, but also handsome on the inside.

EGON is me. I'm EGON.

2. Class, class selector

According to the specified class name, find the corresponding label in the current interface, and then set the properties

. Class name {attribute: value;}

Example

Id selector .p1 {color: red;} .p2 {color: green;} .p3 {color: blue;} most people are handsome, floating on the surface, handsome in appearance

And EGON is not only handsome on the outside, but also handsome on the inside.

EGON is me. I'm EGON.

# practice the color of the first and third lines is red. The font size of the first and second lines is 50px. The second and third lines have an underlined id selector. P1 {color: red;} .p2 {font-size: 50px;} .p3 {text-decoration: underline;} first line content

The second line

The third line

3. Tag selector

Find all tags with that name in the current interface according to the specified tag name, and then set the properties

Tag name {attribute: value;}

Examples are as follows:

Tag selector p {color: red;}

EGON's beautiful appearance actually hides a restless heart.

This heart is called Qiqiao exquisite Heart. Men will cry when they eat it, while women will get pregnant after eating it.

4. Wildcard selector

Select all tags

* {attribute: value;} wildcard selector * {color: red;} I am the title, I am the paragraph

I am hyperlinked to this, I believe you have a deeper understanding of "css how to select the tag", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report