I want to create the above image using CSS, to use it as a button (placing text above it).
Button size: width is 180px, height is 36px
Can anyone help me?
I want to create the above image using CSS, to use it as a button (placing text above it).
Button size: width is 180px, height is 36px
Can anyone help me?
Join a triangle and a div http://jsfiddle.net/togwsmme/21/
.btn {
width: 100px;
height: 100px;
background: red;
float: left;
}
.rit {
float: left;
width: 0;
height: 0;
border-top: 100px solid red;
border-right: 100px solid transparent;
}
<div class="btn">Content</div>
<div class="rit"></div>
you can try this code
.ribbon {
font-size: 16px !important;
width: 150px;
cursor:pointer;
position: relative;
background: #000;
color: #fff;
text-align: center;
padding: 0.5em 0px; /* 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:after {
left: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ribbon:after {
border-color: rgba(136, 183, 213, 0);
border-left-color: #000;
border-width: 0px 0px 36px 44px;
top: 1%;
}
<h1 class="ribbon">
<strong class="ribbon-content">Button</strong>
</h1>
#triangle {
width: 0;
height: 0;
border-top: 60px solid #213971;
border-right: 60px solid transparent;
float: left;
}
#rect {
width: 300px;
height: 60px;
background: #213971;
float: left;
}
#text {
position: absolute;
line-height: 60px;
padding-left: 20px;
font-size: 20px;
color: white;
font-family: sans-serif;
}
<div id="rect">
</div>
<div id="triangle">
</div>
<div id="text">Awesome</div>