Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use HTML first-child pseudo-class

Shulou Source: shulou.com Published: 2022-06-01 04:24:52 09月24日 Update

This article mainly explains "how to use HTML first-child pseudo-classes". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use HTML first-child pseudo-classes.

You might use the first-child pseudo-class to determine the first child of the element. This particular pseudo class is simply misunderstood, so an example is needed to illustrate it. Consider the following symbols:

These are the necessary steps:

Intert KeyTurn key clockwisePush accelerator

Do not push the brake at the same time as the accelerator.

In the above example, the element as the first element includes the first p, the first li, and the strong and em elements.

Given the following rules:

P:first-child {font-weight: bold;} li:first-child {text-transform:uppercase;}

The first rule configures all p elements that are the first child of an element as bold. The second provision capitalizes all li elements that are the first child of an element (in HTML, this must be an ol or ul element).

Please see the link to search for the effect of this: first-child instance.

Hint: the most common mistake is to assume that a resolver such as p:first-child will select the first child of the p element.

To be clear: it must be declared that first-child will be slightly effective in IE.

At this point, I believe you have a deeper understanding of "how to use HTML first-child pseudo-classes". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Element size content learning practical deeper effective example interest resolution uppercase example practical practical common inevitable talent simple operation effect method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Xiaomi Shulou Tech Info Huawei macOS