Detailed explanation of example code of CSS :active selector
Active's passage
active's English explanation is "active", which means clicking on the mouse. The most common examples of the active selector are probably applied to links. However, opening a link is a momentary action, which does not reflect the characteristics of the active selector well.
Characteristics of Active
In fact, when we open a link with active, there is a process to activate active, which is to click on the module until the module is released. If we do not specify the time this process takes, I think it takes a few tenths of a second by default.
<!DOCTYPE html><html> <head> <title>a</title> <meta name="content-type" content="text/html; charset=UTF-8"> <style> a{ display:block; width:30px; margin:20px; border-radius:8px; padding:20px 50px; text-align:center; background:green; } a:active{ background:indigo; } </style> </head> <body> <a href="paris.jpg">link</a> </body></html>
We can adjust this time through the transition attribute.
a:active{ background:indigo; transition:3s; }
Readers can do an experiment, change the value of the transition, and then test: the time spent by the avtive selector .
ACTIVE example
<!DOCTYPE html><html> <head> <title>a</title> <meta name="content-type" content="text/html; charset=UTF-8"> <style> p { width:100px; height:100px; background:red; transition: 5s; } p:active { width:300px; height:300px; transition:3s; } </style> </head> <body> <p></p> </body></html>
There are two transitions, which means there are two transition.
The first transition is to activate the active selector, at this time p: The transition in avtive works.
The second transition is the process of releasing the mouse and returning the image size to normal. At this time, the transition in p takes effect.
If the reader only sets the transition in p , then the transition time of the selector will default to the transition in p .
The above is the detailed content of Detailed explanation of example code of CSS :active selector. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In CSS, the identifier of the id selector is "#". You can specify a specific style for the HTML element marked with a specific id attribute value. The syntax structure is "#ID value {attribute: attribute value;}". The ID attribute is unique and non-repeatable in the entire page; the ID attribute value should not start with a number. IDs starting with numbers will not work in Mozilla/Firefox browsers.

Use the :nth-child(n+3) pseudo-class selector to select the style of child elements whose position is greater than or equal to 3. The specific code example is as follows: HTML code: <divid="container"><divclass="item"> ;First child element</div><divclass="item"&

In the previous article "Css Pseudo-Selector Learning - Pseudo-Element Selector Analysis", we learned about pseudo-element selectors, and today we take a closer look at pseudo-class selectors. I hope it will be helpful to everyone!

The JavaScript selector fails because the code is not standardized. The solution is: 1. Remove the imported JS code and the ID selector method will be effective; 2. Just introduce the specified JS code before introducing "jquery.js".

From beginner to proficient: Master the skills of using is and where selectors Introduction: In the process of data processing and analysis, the selector is a very important tool. Through selectors, we can extract the required data from the data set according to specific conditions. This article will introduce the usage skills of is and where selectors to help readers quickly master the powerful functions of these two selectors. 1. Use of the is selector The is selector is a basic selector that allows us to select the data set based on given conditions.

Not included. CSS selectors include: 1. Tag selector, which locates specific HTML elements through the element name of the HTML page; 2. Class selector, which locates specific HTML elements through the value of the class attribute of the HTML element; 3. ID selector, which Locate specific HTML elements through the value of the id attribute of the HTML element; 4. The wildcard selector "*" can refer to all types of tag elements, including custom elements; 5. The attribute selector uses the existing attribute name of the HTML element or attribute value to locate a specific HTML element.

In-depth analysis of is and where selectors: improving the level of CSS programming Introduction: In the process of CSS programming, selectors are an essential element. They allow us to select and style elements in an HTML document based on specific criteria. In this article, we will take a deep dive into two commonly used selectors namely: is selector and where selector. By understanding their working principles and usage scenarios, we can greatly improve the level of CSS programming. 1. is selector is selector is a very powerful choice
