I am trying to make a corner ribbon in a div and its going everywhere I want it to look neat and nice it goes over the div and does not sit well.
You can try this code, In HTML,
Hello
In CSS,
.columns {
font-size: 16px !important;
/* This ribbon is based on a 16px font side and a 24px vertical rhythm. I've used em's to position each element for scalability. If you want to use a different font size you may have to play with the position of the ribbon elements */
width: 50%;
position: relative;
background: #ba89b6;
color: #fff;
text-align: center;
padding: 1em 2em; /* 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. */
}
.columns:before, .columns:after {
content: "";
position: absolute;
display: block;
bottom: -1em;
border: 1.5em solid #986794;
z-index: -1;
}
.columns:before {
left: -2em;
border-right-width: 1.5em;
border-left-color: transparent;
}
.columns:after {
right: -2em;
border-left-width: 1.5em;
border-right-color: transparent;
}
.columns .corner-ribbon:before, .columns .corner-ribbon:after {
content: "";
position: absolute;
display: block;
border-style: solid;
border-color: #804f7c transparent transparent transparent;
bottom: -1em;
}
.columns .corner-ribbon:before {
left: 0;
border-width: 1em 0 0 1em;
}
.columns .corner-ribbon:after {
right: 0;
border-width: 1em 1em 0 0;
}
.columns.top-right {
top: 75px;
right: -75px;
left: auto;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
/* overflow: hidden; */
z-index: 10;
}
For reference, just go through this nice article https://css-tricks.com/snippets/css/ribbon/