Skip to content

Instantly share code, notes, and snippets.

@Acconut
Created August 28, 2012 11:18
Show Gist options
  • Save Acconut/3497330 to your computer and use it in GitHub Desktop.
Save Acconut/3497330 to your computer and use it in GitHub Desktop.
CSS Ribbon
/**
* CSS Ribbon
*/
#box {
position: relative;
width: 300px;
height: 75px;
}
#box:hover {
width: 500px;
transition: all 1s;
}
#front {
position: absolute;
background: red;
height: 100%;
width: 100%;
z-index: 2;
color: white;
font-family: arial;
font-weight: bold;
font-size: 30px;
text-align: center;
line-height: 75px;
}
#back {
height: 100%;
width: 75px;
background: yellow;
position: absolute;
z-index: 1;
right: -50px;
top: 25px;
}
#back #cut {
height: 0px;
width: 0px;
position: absolute;
z-index: 3;
border: 38px solid white;
border-color: transparent white transparent transparent;
}
#edge {
width: 0px;
height: 0px;
position: absolute;
border-color: blue transparent transparent transparent;
border-style: solid;
border-width: 25px;
border-left-width: 0px;
z-index: 3;
top: 100%;
right: 0px;
}
<div id="box">
<div id="front">
Hover me
</div>
<div id="edge"></div>
<div id="back">
<div id="cut"></div>
</div>
</div>
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment