How to create CSS Bookmark ribbon horizontally with text?


hello, I would like to know how can I create css bookmark ribbon horizontally aligned with text? Here is the example screenshot

css-boookmark-ribbon-how-to-generate.png

Any example custom CSS or bootstrap solution or tutorial link for this, thanks.


Asked by:- manish
1
: 9739 At:- 8/17/2018 1:00:20 PM
CSS css horizontal ribbon







2 Answers
profileImage Answered by:- jon

You can use the below CSS for creating horizontal bookmark ribbon 

 .bookmarkRibbon {
        width: 105px;
        height: 0;
        border-bottom: 20px solid #045089;
        border-top: 20px solid #045089;
        border-left: 15px solid transparent;
        float: right;
        margin-bottom: 20px;
        font-size: 17px;
        font-weight:700;
        position: absolute;
        right: 0px;
        top: 20px;
    }

HTML

<div class="bookmarkRibbon"><span style="color:white;position: relative;top: -9px;text-align: center;right: -10px;">20% OFF</span></div>

Here is the working fiddle for you to test.

2
At:- 8/20/2018 3:33:40 PM
Excellent answer, thank you 0
By : manish - at :- 8/25/2018 2:22:40 PM


profileImage Answered by:- vikas_jk

Above answer is perfect, but if you need right-side ribbon without text, then you can have CSS

.cssRibbon{
  border:       50px solid blue;        /* All borders set */
  border-left:  0;                      /* Remove left border */
  border-right: 30px solid transparent; /* Right transparent */
  width:        100px;                  /* Increase element Width */
}

HTML

<div class="cssRibbon"></div>

here is fiddle demo: https://jsfiddle.net/gqvb869t/

1
At:- 1/7/2021 11:46:47 AM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use