练习中的图标来自font-awsome
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>伸长</title>
<link rel="stylesheet" href="../font-awesome-4.7.0/font-awesome-4.7.0/css/font-awesome.css">
</head>
<style>
*{
padding: 0;
margin: 0;
font-family: "montserrat",sans-serif;
}
.box{
height: 40px;
display: flex;
justify-content: center;
text-align: center;
color: white;
}
.box i{
background-color: #2f3542;
width: 40px;
line-height: 40px;
}
.email,.tbn{
border: none;
outline: none;
}
.email{
width: 0px;
transition: 0.6s;
}
.box:hover > .email,.email:focus{
width: 260px;
padding: 0 10px;
}
.tbn{
background: #2f3542;
padding: 0 10px;
color: white;
text-transform: uppercase;
cursor: pointer;
}
</style>
<body>
<div class="box">
<i class="fa fa-envelope"></i>
<input class="email" type="text" placeholder="Email Address">
<button class="tbn">Subscribe</button>
</div>
</body>
</html>