-5

Width is 180px, height is 36px, need to use it as a button

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?

web-tiki
  • 99,765
  • 32
  • 217
  • 249
Sharath-designer
  • 111
  • 3
  • 11

3 Answers3

6

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>
Akshay
  • 14,138
  • 5
  • 46
  • 70
4

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>
priya786
  • 1,804
  • 12
  • 11
3

Using CSS Shapes

#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>
The Pragmatick
  • 5,379
  • 27
  • 44