Skip to content

Instantly share code, notes, and snippets.

@lgmcolin
Last active December 30, 2015 07:49
Show Gist options
  • Save lgmcolin/7799011 to your computer and use it in GitHub Desktop.
Save lgmcolin/7799011 to your computer and use it in GitHub Desktop.
用translate3d实现input拉长 效果:http://jsbin.com/uqODOPi/1/edit
<style>
body {
margin: 100px;
}
.clipped {
position: relative;
width: 154px;
}
.clipped .clip {
position: absolute;
right: 0px;
width: 50px;
height: 25px;
border: 2px solid #CCC;
border-radius: 0 4px 4px 0;
border-left: 0px;
pointer-events: none;
}
input {
-webkit-transition: -webkit-transform 400ms ease;
border: 2px solid #CCC;
border-radius: 4px;
border-right: 0px;
height: 25px;
width: 150px;
}
input:focus {
-webkit-transform: translate3d(-40px, 0, 0);
outline: none;
}
<style>
<body>
<div class="clipped">
<div class="clip"></div>
<input type="text" />
</div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment