Skip to content

Instantly share code, notes, and snippets.

@christianhanvey
Created May 16, 2012 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save christianhanvey/2708650 to your computer and use it in GitHub Desktop.
Save christianhanvey/2708650 to your computer and use it in GitHub Desktop.
Green Corner Ribbon
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Green Corner Ribbon &middot; CodePen</title>
<style>
body {
background: #eee;
}
.wrapper {
margin: 50px auto;
width: 80%;
height: 370px;
background: white;
border-radius: 10px;
box-shadow: 0px 0px 8px rgba(0,0,0,0.3);
position: relative;
z-index: 90;
}
.ribbon-wrapper-green {
width: 85px;
height: 88px;
overflow: hidden;
position: absolute;
top: -2px;
right: -2px;
}
.ribbon-green {
font-weight: bold;
font-family: Sans-Serif;
color: #333;
font-size: 15px;
text-align: center;
text-shadow: white 0px 1px 0px;
transform: rotate(45deg);
position: relative;
padding: 7px 0 ;
left: -5px;
top: 13px;
width: 120px;
background: -webkit-gradient(linear, left top, left bottom, from(#BFDC7A), to(#8EBF45));
color:#6a6340;
box-shadow: 0px 0px 3px 2px rgba(0,0,0,0.3);
}
.ribbon-green:before, .ribbon-green:after {
content: "";
/* Colour of the triangle. To flip the effect, use border-bottom. */
border-top: 3px solid #6e8900;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
position:absolute;
bottom: -3px; /* +1 to compensate for the border */
}
.ribbon-green:before {
left: 0px;
}
.ribbon-green:after {
right: 0px;
}​
</style>
<script src="http://codepen.io/javascripts/libs/prefixfree.min.js"></script>
</head>
<body>
<div class="wrapper">
<div class="ribbon-wrapper-green">
<div class="ribbon-green">NEWS</div>
</div>
</div>​
</body>
</html>
<div class="wrapper">
<div class="ribbon-wrapper-green">
<div class="ribbon-green">NEWS</div>
</div>
</div>​
body {
background: #eee;
}
.wrapper {
margin: 50px auto;
width: 80%;
height: 370px;
background: white;
border-radius: 10px;
box-shadow: 0px 0px 8px rgba(0,0,0,0.3);
position: relative;
z-index: 90;
}
.ribbon-wrapper-green {
width: 85px;
height: 88px;
overflow: hidden;
position: absolute;
top: -2px;
right: -2px;
}
.ribbon-green {
font-weight: bold;
font-family: Sans-Serif;
color: #333;
font-size: 15px;
text-align: center;
text-shadow: white 0px 1px 0px;
transform: rotate(45deg);
position: relative;
padding: 7px 0 ;
left: -5px;
top: 13px;
width: 120px;
background: -webkit-gradient(linear, left top, left bottom, from(#BFDC7A), to(#8EBF45));
color:#6a6340;
box-shadow: 0px 0px 3px 2px rgba(0,0,0,0.3);
}
.ribbon-green:before, .ribbon-green:after {
content: "";
/* Colour of the triangle. To flip the effect, use border-bottom. */
border-top: 3px solid #6e8900;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
position:absolute;
bottom: -3px; /* +1 to compensate for the border */
}
.ribbon-green:before {
left: 0px;
}
.ribbon-green:after {
right: 0px;
}​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment