The elements in the figcaption
tag are not properly aligned according to the position of the image in the img tag, they are aligned according to the figure tag, that is, when you define a css property, text-align="center"
, what you do is to align the text to the center of figure and not img .
One thing you can do to fix this is to set a size for the figure tag, and then assign a width
property to the img css with < in> 100% of the value, which will be equal to the total size of this ( figure
) container. So the text will always be aligned to the center of the image, and the container itself.
figure {
width:500px;
height:500px;
}
figure img {
width:100%;
}
figurecaption p, i {
text-align:center;
}
NOTE: figurecaption p, i fixes the comma between the 2 elements (p, i), without it the reference would be to the element i
within the element ( p
), with comma the applied property would be for the element p
and the element i
inside the figcaption tag.