Running a website, I am facing an issue with adding copyright information to the top-left corner of an image. The img
element is set to float:left;
and the figcaption
appears after it. However, there are some complications:
1) Using the position:absolute
CSS style on the figcaption
element overlays the caption on the image as desired. Yet, when multiple images are listed consecutively, the captions do not align to the top-left corner but appear randomly on the page.https://i.sstatic.net/7Ur1V.png
2) Employing the position:relative
CSS style on the figcaption
element positions the caption beside the image. To resolve this, left:-410px;
has been added to the figcaption
CSS due to consistent image width. However, the p
element wrapping next to the img
results in a gap left by the initial position of the figcaption
.https://i.sstatic.net/SUPZW.png
The main question remains: how can the figcaption
be placed in the top-left corner of the img
element without impacting the wrapping or indenting of the p
element?
Code sample: https://jsfiddle.net/ComputerWhiz/mp9sdqq3/1/