user6503334 user6503334 - 1 month ago 5
jQuery Question

How to add preview banner to web page?

I have a requirement but i don't understand how to explain my requirement so i create a image that will give clear idea about my question.

enter image description here


It is called a "ribbon" effect. I have created a codepen here showing how to get it done as simple as possible without dirtying the CSS.

Your HTML should be as simple as this

<div class="ribbon-wrapper">
  <div class="ribbon">
    <a href="#">Text you want <i class="fa fa-twitter"></i></a>

Below is the CSS:

.ribbon-wrapper {
  position: relative;
  left: -41px;
  top: 49px;
  width: 150px;
  -ms-transform: rotate(-45deg);
  -webkit-transform: rotate(-45deg);
  transform: rotate(-45deg);
  border-color: #a00;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 30px solid #a00;
  box-shadow: 0px 6px 5px -5px rgba(0, 0, 0, 0.5);
  z-index: 999;
.ribbon-wrapper .ribbon {
  position: absolute;
  left: -15px;
  top: 2px;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.7);
  width: 180px;
  text-align: center;
.ribbon-wrapper .ribbon a {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #d8d8d8;
  text-decoration: none;
  text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
  text-align: center;
  line-height: 22px;
  display: inline-block;
  border-top: 1px dotted rgba(255, 255, 255, 0.7);
  transition: color 500ms ease;
.ribbon-wrapper .ribbon a:hover {
  color: #fff;
  text-shadow: 0 1px rgba(0, 0, 0, 0.85);