A Pen by Vincent Tang on CodePen.
Last active
June 8, 2018 15:57
-
-
Save vincentntang/c8cee6d836a47cb056b42abf98248b2c to your computer and use it in GitHub Desktop.
Overclip text on hover
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
.wrapper | |
a.mouseover-me. | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vel lacus est. Ut vulputate venenatis mauris porta ornare. Nunc vehicula dapibus sem eget maximus. Nunc vehicula dapibus sem eget maximus. Nunc vehicula dapibus sem eget maximus. | |
h1.override-me HOVER ABOVE PARAGRAPH TO HIDE THIS TEXT PARTIALLY, BUT KEEP THIS H1 TEXT IN THE SAME POSITION |
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
* { | |
margin: 0; | |
box-sizing: border-box; | |
} | |
.wrapper { | |
margin: 50px; | |
width: 200px; | |
position: relative; /* So position absolute stays in this box */ | |
} | |
.mouseover-me { | |
display: block; /* <a> tag has no defaults */ | |
height: 55px; | |
position: absolute; | |
max-height: 55px; | |
overflow-y: hidden; | |
z-index: 20; | |
} | |
.mouseover-me:hover{ | |
background-color: lightgrey; | |
z-index: 20; | |
max-height: none; | |
height: auto; | |
} | |
.override-me { padding-top: 55px; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment