Last active
May 3, 2019 12:09
-
-
Save sardinecan/290cd82ca8f823785d3b95aef83571f7 to your computer and use it in GitHub Desktop.
Button cross/close - pure CSS
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
button { | |
position:relative; | |
border:0; | |
border-radius:100%; | |
background-color:#d44949; | |
width:32px; | |
height:32px; | |
} | |
.delete button span { | |
visibility:hidden; | |
opacity: 1; | |
} | |
.delete button span:hover { | |
opacity: 1; | |
border:0; | |
} | |
.delete button span:before, button span:after { | |
position: absolute; | |
visibility:visible; | |
left: 15px; | |
content: ' '; | |
height: 15px; | |
width: 3px; | |
background-color: white; | |
} | |
.delete button span:before { | |
transform: rotate(45deg); | |
} | |
.delete button span:after { | |
transform: rotate(-45deg); | |
} | |
</style> | |
</head> | |
<body> | |
<span class="delete"> | |
<button> | |
<span>+</span> | |
</button> | |
</span> | |
<script id="jsbin-source-css" type="text/css">button { | |
position:relative; | |
border:0; | |
border-radius:100%; | |
background-color:#d44949; | |
width:32px; | |
height:32px; | |
} | |
.delete button span { | |
visibility:hidden; | |
opacity: 1; | |
} | |
.delete button span:hover { | |
opacity: 1; | |
border:0; | |
} | |
.delete button span:before, button span:after { | |
position: absolute; | |
visibility:visible; | |
left: 15px; | |
content: ' '; | |
height: 15px; | |
width: 3px; | |
background-color: white; | |
} | |
.delete button span:before { | |
transform: rotate(45deg); | |
} | |
.delete button span:after { | |
transform: rotate(-45deg); | |
} | |
</script> | |
</body> | |
</html> |
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
button { | |
position:relative; | |
border:0; | |
border-radius:100%; | |
background-color:#d44949; | |
width:32px; | |
height:32px; | |
} | |
.delete button span { | |
visibility:hidden; | |
opacity: 1; | |
} | |
.delete button span:hover { | |
opacity: 1; | |
border:0; | |
} | |
.delete button span:before, button span:after { | |
position: absolute; | |
visibility:visible; | |
left: 15px; | |
content: ' '; | |
height: 15px; | |
width: 3px; | |
background-color: white; | |
} | |
.delete button span:before { | |
transform: rotate(45deg); | |
} | |
.delete button span:after { | |
transform: rotate(-45deg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment