Get the App
SLTechnology News&Howtos  ›  Development  › 

HTML how to set H2 elements and paragraphs are gray

Shulou Source: shulou.com Published: 2022-06-01 05:05:16 10月03日 Update

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!

Tags: Element gray paragraph comma grouping two content resolution more pattern knowledge rules practicality clarity learning next practice creator right descendant Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MariaDB Microsoft Huawei vpn