- This topic has 5 replies, 2 voices, and was last updated 5 years, 5 months ago by Skandha.
-
AuthorPosts
-
October 29, 2018 at 2:27 pm #158017abisbeeParticipant
Hi. My image captions are left-aligned, but sometimes I want to center a caption. How can I do this selectively? This is my CSS code for image captions:
/*Image captions: format
—————————-*/
.wp-caption .wp-caption-text {
margin-bottom: 0.2em;
padding: 0 5px 5px 5px;
position: relative;
text-align: left;
font-size: 12px;
}Thank you.
AliceOctober 29, 2018 at 11:51 pm #158021SkandhaParticipant@abisbee: Please post in your site URL where you want to center align the caption.
Kind Regards,
SkandhaOctober 30, 2018 at 12:02 am #158026abisbeeParticipanthttps://wellnesswarriorsboston.org/traininG
If you can’t see that page, try
https://wellnesswarriorsboston.org/special-events/Thank you.
October 30, 2018 at 12:39 am #158032SkandhaParticipant@abisbee: To center align the image captions selectively
Go to => Appearance => Customize => Additional CSS and add the following CSS Code.#attachment_5562 .wp-caption-text { text-align:center; }
This will center align the caption of the first image on this https://wellnesswarriorsboston.org/special-events/
Like wise if you want to center align the caption of only the second image use the following CSS Code.#attachment_5565 .wp-caption-text { text-align:center; }
So, different images have different #attachment_ids. You will need to use the ids to selectively center align the captions.
Hope this helps you out. Have a good day! 🙂
Kind Regards,
SkandhaOctober 30, 2018 at 7:32 am #158062abisbeeParticipantThank you, Skandha. I was hoping that I could do this with html, rather than having to code each caption separately in css. Is it possible to set alignments for all captions on one page through css?
AliceNovember 1, 2018 at 4:28 am #158225 -
AuthorPosts
- The topic ‘selective image caption alignment’ is closed to new replies.