页面框架文件
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bar">
<div class="bar_in"></div>
</div>
</body>
</html>
![案例](https://i-blog.csdnimg.cn/direct/7c4ea21520184cde996dedcfb1344b04.png)
样式文件
.bar {
width: 150px;
height: 15px;
border: 1px solid red;
border-radius: 7px;
padding: 1px;
}
.bar_in {
width: 50%;
height: 100%;
background-color: red;
transition: all .7s;
}
.bar:hover .bar_in {
width: 100%;
}