html - How can I make a Input with a span with :before pseudo class? -
it's firts question in stackoverflow ... have input type button, , want add pseudo:class before animation (http://codepen.io/anon/pen/emodkg). know it's impossible because input can't contain something. try add span input, span give class "btn" codepen ...
the problem span on input, have animation it's not clickable.
<span class="btn"><input type="button"></span>
try one, think :)
.btn { position: relative; display: block; margin: 30px auto; padding: 20px; overflow: hidden; border-width: 0; outline: none; border-radius: 2px; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); background-color: #2ecc71; color: #ecf0f1; transition: background-color .8s; text-align: center; } .btn:hover, .btn:focus { background-color: #27ae60; } .btn:before { content: ""; position: absolute; top: 50%; left: 50%; display: block; width: 0; padding-top: 0; border-radius: 100%; background-color: rgba(236, 240, 241, .2); -webkit-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .btn:active:before { width: 100%; padding-top: 100%; transition: width .1s ease-out, padding-top .1s ease-out; } .btn input { display: none; }
<label class="btn"><input type="button" />button</label>
Comments
Post a Comment