Created
June 16, 2021 20:28
-
-
Save andrempeixoto/7411c767fcd8f8071e286322453e5d99 to your computer and use it in GitHub Desktop.
// source https://jsbin.com/tipeyox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="" method="get"> | |
<input type="text" name="search" required="required" placeholder="type here"/> | |
<input type="reset" value="" alt="clear" /> | |
</form> | |
<style> | |
input[type="text"] | |
{ | |
height: 38px; | |
font-size: 15pt; | |
} | |
input[type="text"]:invalid + input[type="reset"]{ | |
display: none; | |
} | |
input[type="reset"] | |
{ | |
background-image: url( https://img.icons8.com/windows/32/000000/macos-close.png ); | |
background-position: center center; | |
background-repeat: no-repeat; | |
height: .8rem; | |
width: .8rem; | |
border: none; | |
background-color: transparent; | |
cursor: pointer; | |
position: relative; | |
left: -1.8rem; | |
} | |
</style> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A search field with a 'clear' button when there's content in it.