Created
March 26, 2013 22:20
-
-
Save ChenReuven/5249841 to your computer and use it in GitHub Desktop.
CSS3: Ribbon Header
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
<p class="ribbon"> | |
<strong class="ribbon-content">Everybody loves ribbons</strong> | |
</p> | |
/** CSS3 Ribbon Header **/ | |
body { | |
padding:2.618em; | |
font-family:sans-serif; | |
} | |
.ribbon { | |
font-size: 16px !important; | |
/* This ribbon is based on a 16px font side and a 24px vertical rhythm. I've used em's to position each element for scalability. If you want to use a different font size you may have to play with the position of the ribbon elements */ | |
position: relative; | |
background: #ba89b6; | |
color: #fff; | |
text-align: center; | |
padding: 1em 2em; /* Adjust to suit */ | |
margin: 0 0 3em; /* Based on 24px vertical rhythm. 48px bottom margin - normally 24 but the ribbon 'graphics' take up 24px themselves so we double it. */ | |
} | |
.ribbon:before, .ribbon:after { | |
content: ""; | |
position: absolute; | |
display: block; | |
bottom: -1em; | |
border: 1.5em solid #986794; | |
z-index: -1; | |
} | |
.ribbon:before { | |
left: -2em; | |
border-right-width: 1.5em; | |
border-left-color: transparent; | |
} | |
.ribbon:after { | |
right: -2em; | |
border-left-width: 1.5em; | |
border-right-color: transparent; | |
} | |
.ribbon .ribbon-content:before, .ribbon .ribbon-content:after { | |
content: ""; | |
position: absolute; | |
display: block; | |
border-style: solid; | |
border-color: #804f7c transparent transparent transparent; | |
bottom: -1em; | |
} | |
.ribbon .ribbon-content:before { | |
left: 0; | |
border-width: 1em 0 0 1em; | |
} | |
.ribbon .ribbon-content:after { | |
right: 0; | |
border-width: 1em 1em 0 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment