Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set up active controls in CSS

Shulou Source: shulou.com Published: 2022-06-01 10:42:34 10月06日 Update

This article mainly introduces the CSS how to set active control related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this CSS how to set active control article will have a harvest, let's take a look.

Let's first look at the grammatical format:

: focus {

(style description)

}

Describe it by specifying elements, classes, and ID, as follows:

When setting a specific label

(signature): focus {

(style description)

}

When setting up a specific class

. (class name): focus {

(style description)

}

When setting up a specific ID

# (id name): focus {

(style description)

}

Code example:

Write the following code.

FocusSelector.css

Input {

Background-color:#D0D0D0

}

Input:focus {

Background-color:#FFD0D0

}

Description:

Because "input" is described, the style of the INPUT tag is defined and the background color is specified as gray (# D0D0D0). The definition of a normal INPUT is

Input {background-color:#D0D0D0;}

Receives and activates the style definition for focus, and the background color is specified as pink (# FFD0D0).

Input:focus {background-color:#FFD0D0;}

FocusSelector.html

Enter 1:

Enter 2:

Enter 3:

Enter 4:

Enter 5:

This is the end of the article on "how to set active controls in CSS". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to set active controls in CSS". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Style input initiative control knowledge code content label article background color value element easy to operate article easy to understand more format active gray Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Huawei Xiaomi Microsoft