我希望当你聚焦或悬停在输入框上时,它可以完美居中。
因此,我希望它在中间扩展宽度,而不是向右扩展或产生类似效果。
因此,我希望它在中间扩展宽度,而不是向右扩展或产生类似效果。
The code:
.container {
margin-top: 10px;
margin-left: auto;
margin-right: auto;
width: 142px;
}
.textbox {
border: 1px solid #848484;
outline: 0;
height: 25px;
width: 125px;
padding: 2px 20px 2px 20px;
}
input {
text-align: center;
width: 100px;
transition: ease-in-out, width .35s ease-in-out;
margin-bottom: 3px;
margin-top: 3px;
}
input:hover, input:focus {
width: 150px;
margin-bottom: 3px;
margin-top: 3px;
}
<div class="container">
<input type="text" class="textbox" placeholder="Some text in here!">
</div>