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

HTML how to set H2 elements and paragraphs are gray

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "how to set H2 elements and paragraphs in HTML". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Decision maker grouping

If you want h3 elements and paragraphs to have gray. The easiest way to achieve this is to use the following declaration:

H3, p {color:gray;}

A rule is defined by placing the h3 and p selector to the left of the demarcation rule and then annexing it with a comma. The pattern on the right (color:gray;) will apply to the elements referenced by the two determiners. Comma describes the hunting device, in which two conflicting decision makers are netted in the rule. Without this comma, there will be a complete gap in the meaning of delineation. See descendant determiner.

Any number of selectors can be grouped together without any restriction.

For example, if you want multiple elements to appear gray, you can use a delineation rule similar to the following:

Body, h3, p, table, th, td, pre, strong, em {color:gray;}

Hint: after grouping, creators can "tighten" certain types of styles together, how to get a more concise grid table.

The following two groups of rules can get the same, but it is clear which is easier to write:

/ * no grouping * / H2 {color:blue;} h3 {color:blue;} h4 {color:blue;} h5 {color:blue;} h6 {color:blue;} h7 {color:blue;} / * grouping * / H2, h3, h4, h5, h6, h7 {color:blue;} "how to set H2 elements and paragraphs are gray" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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