<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style>
.search{
width:80px;
height:40px;
border-radius:40px;
border:2px solid lightblue;
position: absolute;
outline:none;
text-indent:12px;
color:#666;
font-size:16px;
padding:0;
-webkit-transition:width 0.5s;}
.search:focus{
width:200px;}
</style>
<body>
<input class="search" type="text" placeholder="搜索...">
</body>
</html>
CSS :focus 选择器
:focus选择器用于选择具有焦点的元素。
网友评论