Photoshopan kicsit macerás elkészíteni, bár annyira nem számít nehéznek, de egy egyszerű CSS kóddal már pár másodperc alatt megtudjuk csinálni!
Ezt kell a CSS-be beírni:
.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 */
width: 50%;
position: relative;
background: #ba89b6;
color: #fff;
text-align: center;
padding: 1em 2em; /* Adjust to suit */
margin: 2em auto 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;
-moz-box-shadow: 3px 3px 4px #999;
-webkit-box-shadow: 3px 3px 4px #999;
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;
}
|
|
|
Azért, hogy ez működjön minden böngészőben, és a lényege a szalagnak ne tűnjön el, hozzá kell adnunk egy "protectort-t". Ezt illeszük be ez után, vagy bárhova a css-ben.
.non-semantic-protector { position: relative; z-index: 1; }
|
|
|
Maga a kód, amit használnunk kell, hogy megkapjuk ezt a szalagot, a forráskódba illesztendő:
<div class="non-semantic-protector">
<h1 class="ribbon">
<em><strong class="ribbon-content">ide jön a te szöveged></em></h1>
</div>
|
|
|
A kód alapja
|