- This topic has 13 replies, 4 voices, and was last updated 5 months ago by
David.
-
AuthorPosts
-
October 20, 2022 at 12:52 pm #2380445
qpaq
Hi,
I’d like to apply a border and hover effect on images that have an URL site-wide. Is it possible to create a CSS that applies all over the website without adding specific classes to images?
October 20, 2022 at 3:01 pm #2380513Ying
StaffCustomer SupportHi there,
Are the images added using WP image blocks?
Let me know!
October 20, 2022 at 3:09 pm #2380520qpaq
Yes, I guess so. It looks like this in the code editor for an image. Images are within containers.
<!-- wp:generateblocks/container {"uniqueId":"72686c03","isGrid":true,"gridId":"4c9b1d65","width":20,"widthMobile":100,"isDynamic":true,"blockVersion":2} --> <!-- wp:image {"align":"center","id":499,"sizeSlug":"full","linkDestination":"custom","className":"hoveroverlay"} --> <figure class="wp-block-image aligncenter size-full hoveroverlay"><a href="https://???.com/???"><img src="https://static.???.com/???.jpg" alt="" class="wp-image-499"/></a></figure> <!-- /wp:image -->
October 20, 2022 at 5:30 pm #2380582Fernando Customer Support
Hi Qpaq,
For reference, can you provide the link to the site in question?
You may use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
October 21, 2022 at 12:15 am #2380775qpaq
Hi,
I’m pasting the URL in the private info area. The images on the tile patterns section have URL’s with .hoveroverlay classes. But actually I want all images with an URL to have a site-wide CSS style.
October 21, 2022 at 1:10 am #2380813Fernando Customer Support
Hi Qpaq,
Can you try adding this CSS?:
figure a img { border: solid 2px #00ff00; } figure a:hover:after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #ff0000; opacity: 0.4; z-index: 100; } figure { position: relative; }
Replace the background-color and the opacity values to your preference.
October 21, 2022 at 1:25 am #2380831qpaq
Hi Fernando,
I did but no effects are visible. Is it because the images are within containers?
October 21, 2022 at 2:04 am #2380863Fernando Customer Support
I see. I modified the code above, can you try that?
October 21, 2022 at 2:08 am #2380867qpaq
Sorry, no change at all even after purging the cache.
October 21, 2022 at 8:51 am #2381385David
StaffCustomer SupportHi there,
what is the URL the img must contain ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 21, 2022 at 8:55 am #2381397qpaq
Hi David, there is not a single specific URL. I want all images with a link on the site to have an overlay hover effect site wide.
October 21, 2022 at 9:26 am #2381429David
StaffCustomer SupportDon’t know what i was thinking lol
Try this CSS:
.wp-block-image { position: relative; } .wp-block-image a:before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.2); border: 2px solid #f00; opacity: 0; transition: opacity 0.3s ease-in; } .wp-block-image:hover a:before { opacity: 1; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 26, 2022 at 12:48 am #2387015qpaq
Thank you very much, that’s resolved.
October 26, 2022 at 4:07 am #2387362David
StaffCustomer SupportGlad to hear that!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.