Snippets

Pure CSS Ribbon

June 25, 2017

caption ribbon

Pure CSS Ribbon
Ribbon
<div class="ribbon-wrapper"> <div id="ribbon"> <span id="content">Ribbon</span> </div> </div> .ribbon-wrapper { width:100%; height:100%; text-align: center; } #ribbon { padding: .34em 1em; margin: 0; margin-top: 5%; position:relative; color: #ffffff; font: 32px 'Patua One', sans-serif; text-align: center; letter-spacing:0.1em; text-shadow: 0px -1px 0px rgba(0,0,0,0.3); box-shadow: inset 0px 1px 0px rgba(255,255,255,.3), inset 0px 0px 20px rgba(0,0,0,0.1), 0px 1px 1px rgba(0,0,0,0.4); background: -webkit-linear-gradient(top,#1eb2df, #17a7d2); display: inline-block; } #ribbon:before, #ribbon:after { content: ""; width:.2em; bottom:-.5em; position:absolute; display:block; border: .9em solid #1eb2df; box-shadow:0px 1px 0px rgba(0,0,0,0.4); z-index:-2; } #ribbon:before { left:-1.35em; border-right-width: .75em; border-left-color:transparent; } #ribbon:after { right:-1.35em; border-left-width: .75em; border-right-color:transparent; } #content:before, #content:after { content:""; bottom:-.5em; position:absolute; display:block; border-style:solid; border-color: #0675b3 transparent transparent transparent; z-index:-1; } #content:before { left: 0; border-width: .5em 0 0 .5em; } #content:after { right: 0; border-width: .5em .5em 0 0; }

Related Content

Easy Way to Fix Anchor Links Scrolling Too Far

Stories

Easy Way to Fix Anchor Links Scrolling Too Far

Fixed navbar is a very popular way of displaying navigation when a page is scrolled, but you could run into a small detail that needs to be addressed.

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

Stories

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

There are certain cases when you want to dynamically manipulate the page height which will result in flickering.

Changing the Mouse Cursor in CSS With the cursor Property

Stories

Changing the Mouse Cursor in CSS With the cursor Property

Using CSS to change the cursor on your website is a great way to add a little bit of personality to your site.