Pure CSS to achieve horizontal line animation under the element (background-image)

Pure CSS to achieve horizontal line animation under the element (background-image)

Effect picture:

html:

<div class='site_bar'>Home</div>
css:
.site_bar{
  background-image : linear-gradient(red,red);
  background-position : center bottom;
  background-size : 0 2px;
  background-repeat : no-repeat; //This attribute cannot be missing.
  transition : .3s;
}
.site_bar:hover{
  background-size : 100% 2px;
}

Summarize

The above is the pure CSS implementation of horizontal line animation (background-image) under the element introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  Some questions about hyperlinks

>>:  JavaScript imitates Jingdong magnifying glass effect

Recommend

Introduction to several ways to introduce CSS in HTML

Table of contents 1. Embed CSS styles directly in...

Example of how to quickly delete a 2T table in mysql in Innodb

Preface This article mainly introduces the releva...

How to decrypt Linux version information

Displaying and interpreting information about you...

In-depth explanation of MySQL stored procedures (in, out, inout)

1. Introduction It has been supported since versi...

Detailed explanation of JS ES6 coding standards

Table of contents 1. Block scope 1.1. let replace...

How to deploy redis in linux environment and install it in docker

Installation Steps 1. Install Redis Download the ...

How to use Lottie animation in React Native project

Lottie is an open source animation library for iO...

Solution to MySQL Chinese garbled characters problem

1. The Chinese garbled characters appear in MySQL...

Specific method of viewing user authorization information in mysql

Specific method: 1. Open Command Prompt 2. Enter ...

Common symbols in Unicode

Unicode is a character encoding scheme developed ...

MySQL constraint types and examples

constraint Constraints ensure data integrity and ...

HTML tag meta summary, HTML5 head meta attribute summary

Preface meta is an auxiliary tag in the head area...

How to use indexes to optimize MySQL ORDER BY statements

Create table & create index create table tbl1...