Created
December 11, 2013 10:41
-
-
Save shidhincr/7908326 to your computer and use it in GitHub Desktop.
Untitled
This file contains 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
body { | |
background-color: #f1f1f1; | |
font-family: Helvetica,Arial,Verdana; | |
} | |
h1 { | |
color: green; | |
text-align: center; | |
} | |
.redfamily { | |
color: red; | |
} | |
.search-box,.close-icon,.search-wrapper { | |
position: relative; | |
padding: 10px; | |
} | |
.search-wrapper { | |
width: 500px; | |
margin: auto; | |
margin-top: 50px; | |
} | |
.search-box { | |
width: 80%; | |
border: 1px solid #ccc; | |
} | |
.search-box:focus { | |
box-shadow: 0 0 15px 5px #b0e0ee; | |
border: 2px solid #bebe | |
de; | |
} | |
.close-icon { | |
border:1px solid transparent; | |
background-color: transparent; | |
display: inline-block; | |
vertical-align: middle; | |
} | |
.close-icon:after { | |
content: "X"; | |
display: block; | |
width: 15px; | |
height: 15px; | |
position: absolute; | |
background-color: #FA9595; | |
z-index:1; | |
right: 35px; | |
top: 0; | |
bottom: 0; | |
margin: auto; | |
padding: 2px; | |
border-radius: 50%; | |
text-align: center; | |
color: white; | |
font-family: verdana; | |
font-weight: normal; | |
font-size: 12px; | |
box-shadow: 0 0 2px #E50F0F; | |
cursor: pointer; | |
} | |
.search-box:not(:valid) ~ .close-icon { | |
display: none; | |
} |
This file contains 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
<h1> | |
Textbox with a clear button in PURE CSS <br> <span class="redfamily">< 0 lines of JavaScript ></span> | |
</h1> | |
<div class="search-wrapper"> | |
<form> | |
<input type="text" name="focus" required class="search-box" placeholder="Enter search term" /> | |
<button class="close-icon" type="reset"></button> | |
</form> | |
</div> |
This file contains 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
// alert('Hello world!'); |
This file contains 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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment