I am trying to align an image caption on the bottom left side of an image container.
Here is a picture of the desired outcome.
This is the HTML/CSS I am working with:
.elementor-image figure { position: relative; }.elementor-image figure figcaption { position: absolute; bottom: 0; left: -40px; transform: rotate(-90deg); }
<div class="elementor-image"> <figure class="wp-caption"> <img src="https://picsum.photos/200/300"> <figcaption class="widget-image-caption wp-caption-text">The Lorem <span></span></figcaption> </figure> </div>
There are two problems with my code:
Here is another screenshot illustrating the problem.
I hope I have explained myself correctly, I have been banging my head with this, so I would really appreciate your input and thoughts. Thanks!
Simply consider transform-origin:bottom left;
.elementor-image figure { position: relative; }.elementor-image figure figcaption { position: absolute; bottom: 0; left: 0; transform: rotate(-90deg); transform-origin:bottom left; } img { display:block; /* to avoid white space and have a perfect alignment */ }
<div class="elementor-image"> <figure class="wp-caption"> <img src="https://picsum.photos/200/300"> <figcaption class="widget-image-caption wp-caption-text">The Lorem <span></span></figcaption> </figure> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.