The code realizes the expansion effect of css mouse passing through both sides of the element's underline

零到壹度
Release: 2018-04-04 11:09:56
Original
2007 people have browsed it

This article mainly introduces the code to implement the CSS mouse expansion effect on both sides of the element underline. The editor thinks it is quite good. Now I will share it with you and give it as a reference. Let’s follow the editor and take a look

<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">
<title>鼠标移入下划线展开</title>
<style type="text/css">
#underline{  
  width: 200px;   
   height: 50px;    
   background: #ddd;    
   margin: 20px;    
   position: relative;
 }
  
  #underline:after{  
    content: "";    
    width: 0;   
    height: 1px;    
    background: blue;    
    position: absolute;    
    top: 100%;    
    left: 50%;    
    transition: all .8s;
 }
    
    #underline:hover:after{ 
      left: 0%;   
      width: 100%;
 }
 </style>
 
 </head>
 
 <body>   
      <p id="underline"></p>
      
 </body>
 
 </html>
Copy after login

Related recommendations:

Use pseudo-elements and CSS3 to implement mouse movement The underline expands to both sides

The css navigation bar is selected to have the effect of moving the underline

Horizontal navigation bar + navigation bar follow + navigation bar underline sliding effect

The above is the detailed content of The code realizes the expansion effect of css mouse passing through both sides of the element's underline. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template