A quick CSS-only hover effect.
Created
October 8, 2017 09:20
-
-
Save bugsysop/69b0c7caea4597b6d7a8a57ec5ecf5dd to your computer and use it in GitHub Desktop.
Hover dat pic
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
| <div class="box"> | |
| <div class="hover-effect"> | |
| <a href="#" class="hover-text"> | |
| <h1>An Awesome Title</h1> | |
| <p>Descriptive stuff goes here.<p> | |
| </a> | |
| </div> | |
| </div> |
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
| body { | |
| background: #333; | |
| } | |
| .box { | |
| position: relative; | |
| overflow: hidden; | |
| height: 300px; | |
| width: 500px; | |
| background: url('https://ununsplash.imgix.net/photo-1433838552652-f9a46b332c40?dpr=2&fit=crop&fm=jpg&h=700&q=75&w=1050') center left no-repeat; | |
| background-size: cover; | |
| cursor: pointer; | |
| } | |
| .hover-effect { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background: rgba(5, 8, 31, 0.62); | |
| transition: all 0.3s ease-in-out; | |
| opacity: 0; | |
| } | |
| .box:hover .hover-effect { | |
| opacity: 1; | |
| } | |
| .box:hover .hover-text { | |
| right: 0; | |
| } | |
| .hover-text { | |
| position: absolute; | |
| right: -100%; | |
| bottom: 0; | |
| display: block; | |
| max-width: 100%; | |
| padding: 40px 45px; | |
| color: #e2e2e2; | |
| text-decoration: none; | |
| text-align: right; | |
| line-height: 1.5em; | |
| font-size: 15px; | |
| font-family: "Proxima Nova"; | |
| font-weight: 300; | |
| text-transform: uppercase; | |
| letter-spacing: 5px; | |
| transition: all 0.5s ease-in-out; | |
| } | |
| h1 { | |
| font-size: 2em; | |
| font-weight: 500; | |
| padding: 0.8em 0; | |
| margin-bottom: 0.3em; | |
| border-bottom: 1px solid #fff; | |
| } | |
| p { | |
| width: 70%; | |
| line-height: 1.7em; | |
| display: inline-block; | |
| text-align: right; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment