timjphoto Posted May 10 Share Posted May 10 Hi there, I'm looking for way to add text when I hover over images on my site. I've found a way to add the text over the individual blocks, but I'm looking for a way to have the text appear large and in the centre of the screen (please see attached image to demonstrate what I mean) Any help would be much appreciated! Thanks! http://www.timjobling.co.uk Link to comment
Beyondspace Posted May 10 Share Posted May 10 6 hours ago, timjphoto said: Hi there, I'm looking for way to add text when I hover over images on my site. I've found a way to add the text over the individual blocks, but I'm looking for a way to have the text appear large and in the centre of the screen (please see attached image to demonstrate what I mean) Any help would be much appreciated! Thanks! http://www.timjobling.co.uk You can try the following Custom Css /*set each text for image block hovered*/ body:has(#block-yui_3_17_2_1_1647613312964_40288:hover, #block-yui_3_17_2_1_1647613312964_254914:hover, #block-yui_3_17_2_1_1647613312964_73692:hover, #block-yui_3_17_2_1_1647613312964_51836:hover)::after { content: 'Carter Road Skatepark'; opacity: 1; transition: opacity 0.5s ease; } /*General style*/ body::after { content:''; position: fixed; top: 50%; left: 50%; font-size: 40px; transform: translate(-50%,-50%); font-weight: bold; opacity: 0; } My testing Let me know how it works on your site BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
timjphoto Posted May 10 Author Share Posted May 10 Hi @Beyondspace, thanks so much for your reply! That code works amazingly and does what I was after, however I've run in to a couple of problems, firstly when the screen size is reduced the text overlaps and becomes jumbled, is there a way allow the text to resize automatically to fit the screen-size? The second is I'd love the text to be larger, but when you take it over around 65px the same issue happens with the jumbling of the text. I've attached an image so you can see what I mean. Thanks so much again for your help, very much appricaited. Link to comment
Beyondspace Posted May 11 Share Posted May 11 6 hours ago, timjphoto said: Hi @Beyondspace, thanks so much for your reply! That code works amazingly and does what I was after, however I've run in to a couple of problems, firstly when the screen size is reduced the text overlaps and becomes jumbled, is there a way allow the text to resize automatically to fit the screen-size? The second is I'd love the text to be larger, but when you take it over around 65px the same issue happens with the jumbling of the text. I've attached an image so you can see what I mean. Thanks so much again for your help, very much appricaited. Have you added the code yet? I can not see the code on my end BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
timjphoto Posted May 11 Author Share Posted May 11 I've just added back in but I'm excluding it from media screen max width 1000px as that's when the overlapping issue occurs. I would still love the text to be larger and to resize automatically as it would definitely look better but it's working really well so far. Thanks for the help! Link to comment
timjphoto Posted May 11 Author Share Posted May 11 I think I've solved it by adding this code font-size: calc(3vw + 3vh); It seems to be working well! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment