Wednesday, 19 August 2015

Create a 3D Ribbon or Bar in CSS With Before and After Elements

Create a 3D Ribbon or Bar in CSS


HTML Code :--


<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>

    </head>
    <body>
        <div class="ribbon"><div class="ribbon-stitches-top"></div>
            <strong class="ribbon-content"><h1>A 3d Ribbon in CSS</h1></strong>
            <div class="ribbon-stitches-bottom"></div></div>

    </body>
</html>


CSS Code :--



.ribbon
{
margin: 100px 0px 0px 200px;
width: 800px;
position: absolute;
text-align: center;
font-size: 23px!important;
background: #BF3851;
box-shadow: rgba(000,000,000,0.3) 0 1px 1px;
font-family: 'Helvetica Neue',Helvetica, sans-serif;
}
       
.ribbon h1
 {
font-size: 25px!important;
color: #ffffff;
margin:0px;
padding: 15px 10px;
}

.ribbon:before, .ribbon:after
 {
content: '';
position: absolute;
border: 30px solid #BF3851;
bottom: -23px;
z-index: -1;
}

.ribbon:before
{
left: -38px;
border-right-width: 30px;
border-left-color: transparent;
}

.ribbon:after
{
right: -38px;
border-left-width: 30px;
border-right-color: transparent;
}

.ribbon .ribbon-content:before, .ribbon .ribbon-content:after
 {
border-color:#862525  transparent transparent transparent;
position: absolute;
display: block;
border-style: solid;
bottom: -1em;
content: '';
}

.ribbon .ribbon-content:before
{
left: 0;
border-width: 1em 0 0 1em;
}

.ribbon .ribbon-content:after
{
right: 0;
border-width: 1em 1em 0 0;
}


No comments:

Post a Comment