Last active
January 30, 2021 16:54
-
-
Save fajarwz/f90e26ebe4f407df44b3630f03b6698c to your computer and use it in GitHub Desktop.
CSS for floatable item
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
<div class="header"> | |
<h3>Example of floatable</h3> | |
</div> | |
<div class="card floatable"> | |
<h4> | |
Hover me! | |
</h4> | |
</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
.header { | |
width: 100%; | |
height: 40px; | |
} | |
.card { | |
width: 100px; | |
height: 100px; | |
border: 1px solid rgba(0, 0, 0, 0.125); | |
border-radius: 0.5rem; | |
} | |
/* | |
| core code | |
*/ | |
.floatable { | |
margin-top: 5px; | |
margin-bottom: 0; | |
box-shadow: none; | |
transition: margin 0.1s ease-out; | |
} | |
.floatable:hover { | |
cursor: pointer; | |
margin-top: 0; | |
margin-bottom: 5px; | |
box-shadow: 0 5px 5px #00000050; | |
} | |
/* | |
| end of core code | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment