- This topic has 60 replies, 7 voices, and was last updated 7 years, 10 months ago by Tom.
-
AuthorPosts
-
February 20, 2016 at 5:53 am #173988Tony
Hi Tom
I used this code and the caption is under the image and looks fine.
.wp-caption .wp-caption-text {
background: transparent;
padding: 2px 0;
color: #616149;
text-align: center;
position: relative;
}I’m not sure what this post above is about though:
“In order for the links to be visible in case we move captions below images your code, Tom, is not enough. I had to add more lines:”There is then a chunk of different code after this but I’m not sure what it’s trying to achieve or if a conclusion was reached.
QUESTIONS:
1 – how would i put the caption in the image on a post i.e. over-ride the css?
2 – is there a way to have the caption show up only on hover (under the image or over the image)?February 20, 2016 at 1:36 pm #174063TomLead DeveloperLead DeveloperIf you have links in your captions then that extra CSS will be necessary.
1. I’m not sure what you mean by this?
2. This should do it:.wp-caption-text { display: none; } .wp-caption:hover .wp-caption-text { display: block; }
February 20, 2016 at 4:49 pm #174082TonyOK I understand and will try the code out tomorrow.
In Q2 I mean how do I over ride the css that puts the caption under the image if, on some post(s), I want the caption inside the image.February 20, 2016 at 11:07 pm #174103TomLead DeveloperLead DeveloperWill there be more posts with it below or on top of the images?
February 21, 2016 at 12:08 am #174117TonyI have no idea to be honest.
If the hover works ok then probably on top inside the image would be the standard.
Up to now I haven’t used captions on emeddled images. In my gallery and light box it’s automatic and uses hover.
Hold fire and let me have a play today.February 21, 2016 at 4:14 am #174133TonyHaving experimented I believe that if I use a caption it will mostly be in/on the image and only shown on hover.
If I want to override this (position and/or hover) on a post how would I do it?
February 21, 2016 at 11:22 am #174198TomLead DeveloperLead DeveloperYou would have to use the page ID and give the caption different styling for those specific pages.
So if you want the caption below only on a specific page, you would do something like:
.page-id-xx .wp-caption .wp-caption-text { background: transparent; padding: 10px 0; position: relative; color: #000; }
xx being the page ID.
February 22, 2016 at 8:24 am #174391TonyThat works thank you.
I guess that you need a copy of this code for each individual page or can multiple post id’s be used in the same piece of code?February 22, 2016 at 11:06 am #174447TomLead DeveloperLead DeveloperMultiple page IDs can be used, just separate them with commas:
.selector-1, .selector-2, .selector-3 { color: white; }
February 22, 2016 at 11:20 am #174458TonyThank you
March 22, 2016 at 9:05 am #180884LisaHi Tom,
Love your theme. Do you have the time to help? I’ve added
.wp-caption .wp-caption-text {
background: transparent;
padding: 10px 0;
position: relative;
color: #000;
}to the child theme editor but I’m still getting the text with overlay instead of moving the caption text below the image. I’ve also tried
#attachment_398 > figcaption {
background: transparent;
padding: 10px 0;
position: relative;
color: #000;
}
w/o success.Can you help with this?
Thank you,
Lisa
March 22, 2016 at 9:35 am #180890LisaUpdate:
There was an error in the style sheet which was invalidating this code. Error removed and all is working. Thank you so much for posting these responses. The threads are very helpful.
Best,
LisaMarch 22, 2016 at 9:35 am #180891TomLead DeveloperLead DeveloperGlad you fixed it 🙂
- This reply was modified 8 years, 5 months ago by Tom.
July 23, 2016 at 2:08 am #212175AnandI used the text provided by Aaron Redmon on Page 1 of this thread. In Firefox, the caption immediately moved below the image. However, in Chrome and Edge it just stays above the image.
What to do?
Anand
July 23, 2016 at 9:35 am #212257TomLead DeveloperLead DeveloperCan you post the link to your site?
-
AuthorPosts
- You must be logged in to reply to this topic.