Skip to content

Instantly share code, notes, and snippets.

@vincentntang
Last active June 8, 2018 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vincentntang/c8cee6d836a47cb056b42abf98248b2c to your computer and use it in GitHub Desktop.
Save vincentntang/c8cee6d836a47cb056b42abf98248b2c to your computer and use it in GitHub Desktop.
Overclip text on hover
.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
* {
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