CSS Only Ribbon Title
Typical example of a blog-post-like section where the title is shown as a red ribbon exploiting all the power of CSS (and using CSS triangles)
A little (unnecessary) jQuery animation adds some fun.
With the latest update I tested the possibility of adding multiple ribbons: looks good!
HTML
<section class="container">
<h3><span class="left ribbon"></span>The train pursued its course<span class="right ribbon"></span></h3>
<p>Nothing in your eye</p>
<h3><span class="left ribbon"></span>Thirteen hundred and eighty-two miles<span class="right ribbon"></span></h3>
<p>Something just like this</p>
</section>
CSS
@import url(http://fonts.googleapis.com/css?family=Copse);
@import url(http://fonts.googleapis.com/css?family=Oswald);
.container {
border: 1px solid #ccc;
padding: 5px 0 10px 0;
min-height: 100px;
width: 400px;
position: relative;
margin: 20px auto;
left: -2000px;
}
.container h3 {
position: relative;
padding: 5px;
background-color: #cc0000;
color: #fff;
font-size: 24px;
text-align: center;
width: 410px;
left: -10px;
margin-bottom: 10px;
font-family: 'Oswald', arial, serif;
box-shadow: 0 2px 5px #999;
border-top-right-radius: 2px;
border-top-left-radius: 2px;
text-shadow: -1px -1px 0 #8b0000;
}
.container h3 .ribbon {
width: 0px;
height: 0px;
position: absolute;
border-width: 5px;
border-style: solid;
z-index: 2000;
}
.container h3 .left {
left: 0;
bottom: -10px;
border-color: #8b0000 #8b0000 transparent transparent;
}
.container h3 .right {
right: 0;
bottom: -10px;
border-color: #8b0000 transparent transparent #8b0000;
}
.container p {
padding: 5px 10px 10px 10px;
font-family: 'Copse', arial, serif;
}
JavaScript
$(function() {
$('.container').animate({
left: 0,
}, 3000, 'easeOutBounce');
});