First, I'm just starting out in HTML and CSS.
How I want to use this code: https://codepen.io/martinjkelly/pen/vEOBvL
.container {
width: 250px;
height: 250px;
position:relative;
background-color:grey;
}
.corner {
width: 0;
height: 0;
border-top: 150px solid #ffcc00;
border-bottom: 150px solid transparent;
border-right: 150px solid transparent;
}
.corner span {
position:absolute;
top: 35px;
width: 100px;
left: 5px;
text-align: center;
font-size: 16px;
font-family: arial;
transform: rotate(-45deg);
display:block;
}
<div class="container">
<div class="corner"><span>20% Special Offer</span></div>
</div>
But I want to make the triangle at the top/right.
What I tried:
.corner {
width: 0;
height: 0;
border-top: 150px solid transparent;
border-bottom: 150px solid transparent;
border-left: 150px solid transparent;
}
.corner span {
position:absolute;
top: 35px;
width: 100px;
left: 5px;
text-align: center;
color: #ffffff;
text-transform: uppercase;
font-size: 14px;
transform: rotate(45deg);
display:block;
}
It works, but the text is not placed right...
Thanks so much for your help.