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

MySQL full-text search usage examples

Table of contents 1. Environmental Preparation 2....

MySQL Optimization: InnoDB Optimization

Study plans are easily interrupted and difficult ...

Vue realizes adding watermark to uploaded pictures (upgraded version)

The vue project implements an upgraded version of...

Nginx merges request connections and speeds up website access examples

Preface As one of the best web servers in the wor...

How to deploy nodejs service using Dockerfile

Initialize Dockerfile Assuming our project is nam...

Mysql example of splitting into multiple rows and columns by specific symbols

Some fault code tables use the following design p...

A brief discussion of several browser compatibility issues encountered

background Solving browser compatibility issues i...

Summary of Commonly Used MySQL Commands in Linux Operating System

Here are some common MySQL commands for you: -- S...

Detailed installation and use of RocketMQ in Docker

To search for RocketMQ images, you can search on ...

A brief discussion on VUE uni-app custom components

1. Parent components can pass data to child compo...

Eight rules for effective web forms

If you're collecting information from your us...

HTTP return code list (Chinese and English explanation)

http return code list (below is an overview) for ...

mysql 5.7.23 winx64 decompression version installation tutorial

Detailed installation tutorial of mysql-5.7.23-wi...