I currently display some text at the top of an image:
.container {
position: relative;
}
.text-block {
position: absolute;
color: white;
position: absolute;
top: 0px;
left: 0px;
background-color:#17d90d;
font-weight: bold;
padding:5px;
}
<h2>Image Text Blocks</h2>
<div class="container">
<img src="http://lorempixel.com/640/360" alt="Nature" style="width:100%;">
<div class="text-block">
Oferta
</div>
</div>
But what I want is that the word offer is displayed diagonally, and I tried with rotate, but it fails. What I want is for it to look like this:
The idea is that the text of the word offer is displayed the same as the photo. How could it be done?
This is one way to do it, adding a wrapper to make it triangular, and rotating the text:
Mainly you should add a tag to your text so you can manipulate just that section something like this:
Now inside your css add the following line:
I hope it helps