Is there a way to create a slanted div using CSS without relying on borders, especially when the div will be placed over an image? Here is what I have so far:
<div class="thumbnail">
<a href="#">
<img class="img-responsive" src="banner.jpg">
<h3 class="headline-badge">slanted div text</h3>
</a>
</div>
This is the relevant CSS:
.thumbnail img.img-responsive {
width: 100%;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.headline-badge {
color: #fff;
margin-top: 0;
padding: 2%;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
background-color: #000;
}
I am looking for a solution to create a responsive slant towards the top right side of the div without affecting the text. The slant angle should be around 45 degrees and only appear on the right-hand side.
If you have any ideas or examples on how to achieve this effect using CSS, please share them. The end result should resemble something like this:
http://jsfiddle.net/webtiki/yLu1sxmj/
Thank you for sharing the fiddle link, but I need to find a way to add text on top of the div while keeping the slant upwards and not downwards. Additionally, the solution provided made it hard to incorporate additional text as needed. Any suggestions would be greatly appreciated!