Good, in my project when I try to center the text contained between the “figcaption” tags it is not centered. I have already been trying a lot to solve this problem. If the “img” is centered but not “figcaption”. Thank you very much to all who can collaborate. https://codepen.io/emmanuel1510019/pen/RwWoGqP
There’s an error in your code. Run your HTML code through the W3C validator.
- Since copy/paste from codepen you can ignore the first warning and first two errors.
- When you fix the errors you’ll have an easier time centering.
Without setting the width of the #img-caption
element, you can’t center it using margin: auto
because it takes up the entire width of its container:
However you can center the text in the element instead, by using:
#img-caption{
text-align: center;
}
Thank you very much for your help. I really appreciate each person who spends part of their time providing support!
1 Like