Starting my journey in HTML and CSS.
This link shows how I want to use the code:
.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>
However, I aim to position the triangle at the top right instead of its original placement.
Here's what I attempted:
.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;
}
Although it functions, the text positioning is off...
Your assistance is greatly appreciated. Thank you.