"Pure CSS Ribbon Banner"
Bootstrap 3.1.0 Snippet by femotizo

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!-- Ref: --> <div class="container"> <div class="row"> <h2>TEST Bootstrap Ribbons</h2> </div> <header style="padding:3em;height:auto;width:auto;margin:0;text-align:center;"> <h1 style="margin:0;padding:0;">Demo: <a style="color:#00aeef;text-decoration:none;" href="#">Pure CSS Ribbon Banner</a></h1> </header> <figure style="padding:0 3em;overflow:visible;"> <div class="content-box"> <a href="http://youtu.be/zJahlKPCL9g" id="ribbon" target="_blank"> <img class="" src="https://i1.ytimg.com/vi/zJahlKPCL9g/mqdefault.jpg" width="400" > </a> <div id="ribbon-container"> <a href="http://youtu.be/zJahlKPCL9g" id="ribbon" target="_blank">Featured YouTube</a> </div> </div> </figure> </div>
.content-box { width: 410px; height: 235px; margin: 0 auto; position: relative; /* So we can position the banner within the box */ background: gray; border: 5px solid white; box-shadow: 0 0 10px rgba(0,0,0,.3); -moz-box-shadow: 0 0 10px rgba(0,0,0,.3); -webkit-box-shadow: 0 0 10px rgba(0,0,0,.3); } #ribbon-container { position: absolute; top: 15px; right: -20px; overflow: visible; /* so we can see the pseudo-elements we're going to add to the anchor */ font-size: 18px; /* font-size and line-height must be equal so we can account for the height of the banner */ line-height: 18px; } #ribbon-container:before { content:""; height: 0; width: 0; display: block; position: absolute; top: 3px; left: 0; border-top: 29px solid rgba(0,0,0,.3); /* These 4 border properties create the first part of our drop-shadow */ border-bottom: 29px solid rgba(0,0,0,.3); border-right: 29px solid rgba(0,0,0,.3); border-left: 29px solid transparent; } #ribbon-container:after { /* This adds the second part of our dropshadow */ content:""; height: 3px; background: rgba(0,0,0,.3); display: block; position: absolute; bottom: -3px; left: 58px; right:3px; } #ribbon-container a { display:block; padding:20px; position:relative; /* allows us to position our pseudo-elements properly */ background:#0089d0; overflow:visible; height:58px; margin-left:29px; color:#fff; text-decoration:none; } #ribbon-container a:after { /* this creates the "folded" part of our ribbon */ content:""; height: 0; width: 0; display:block; position:absolute; bottom:-15px; right:0; border-top: 15px solid #004a70; border-right: 15px solid transparent; } #ribbon-container a:before { /* this creates the "forked" part of our ribbon */ content:""; height: 0; width: 0; display:block; position:absolute; top:0; left:-29px; border-top: 29px solid #0089d0; border-bottom: 29px solid #0089d0; border-right: 29px solid transparent; border-left: 29px solid transparent; } #ribbon-container a:hover { background:#009ff1; } #ribbon-container a:hover:before { /* this makes sure that the "forked" part of the ribbon changes color with the anchor on :hover */ border-top: 29px solid #009ff1; border-bottom: 29px solid #009ff1; }

Related: See More


Questions / Comments: