Phobic78 Posted September 21, 2022 Share Posted September 21, 2022 Site URL: http://https%3Atracytredoux.com/code-test Hi, I'm trying to create a series of coloured blocks that contain an icon, a title and some text. This is the closest I have been able to get and as you can see from the code below, it's a bit messy. I have had to position the icon and the text manually, and the icon does not stay vertically centred as the screen is resized. If anyone has a suggestion how I could code this more effectively I would be very grateful. <style> .heading{ font-size:1.2em; } .text{ margin-left:60px} .imageplace{ position:absolute; top:30px } .green{ background-color:#c4e5c0; padding:20px 40px 20px 40px; border-radius:0px 20px 0px 20px; max-width: max-content; text-align:center; } </style> <div class="green"> <div class="imageplace"><img src="https://images.squarespace-cdn.com/content/v1/58762023893fc0d94810ba05/1663759321108-63ZII831I0JURY7W4V9T/guide.png?format=500w" alt="Cinque Terre" width="60" height="60"></div><div class="text"><span class="heading">At a Glance</span> – this is your daily protocol for phases 2 and 3 of the program, recipes included and some more test text to see how it resizes as i change the size of the viewport.</div> </div><br> Link to comment
Beyondspace Posted September 21, 2022 Share Posted September 21, 2022 1 hour ago, Phobic78 said: Site URL: http://https%3Atracytredoux.com/code-test Hi, I'm trying to create a series of coloured blocks that contain an icon, a title and some text. This is the closest I have been able to get and as you can see from the code below, it's a bit messy. I have had to position the icon and the text manually, and the icon does not stay vertically centred as the screen is resized. If anyone has a suggestion how I could code this more effectively I would be very grateful. <style> .heading{ font-size:1.2em; } .text{ margin-left:60px} .imageplace{ position:absolute; top:30px } .green{ background-color:#c4e5c0; padding:20px 40px 20px 40px; border-radius:0px 20px 0px 20px; max-width: max-content; text-align:center; } </style> <div class="green"> <div class="imageplace"><img src="https://images.squarespace-cdn.com/content/v1/58762023893fc0d94810ba05/1663759321108-63ZII831I0JURY7W4V9T/guide.png?format=500w" alt="Cinque Terre" width="60" height="60"></div><div class="text"><span class="heading">At a Glance</span> – this is your daily protocol for phases 2 and 3 of the program, recipes included and some more test text to see how it resizes as i change the size of the viewport.</div> </div><br> Can you check your link again? I can not access it now BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date format) 💫 Animated Buttons (Referral URL) 🥳 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
Phobic78 Posted September 21, 2022 Author Share Posted September 21, 2022 4 minutes ago, bangank36 said: Can you check your link again? I can not access it now Sorry, should be: https://tracytredoux.com/code-test Link to comment
Beyondspace Posted September 21, 2022 Share Posted September 21, 2022 Try adding to Home > Design > Custom Css .green { display: flex; align-items: center; } .green .imageplace { position: relative; display: flex; justify-content: center; align-items: center; top: 0; width: 10%; /*increase size of image*/ } .green .text { margin-left: 0; } Support me by pressing 👍 if this useful for you BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date format) 💫 Animated Buttons (Referral URL) 🥳 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
Beyondspace Posted September 21, 2022 Share Posted September 21, 2022 My testing BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date format) 💫 Animated Buttons (Referral URL) 🥳 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
Phobic78 Posted September 21, 2022 Author Share Posted September 21, 2022 4 hours ago, bangank36 said: Try adding to Home > Design > Custom Css .green { display: flex; align-items: center; } .green .imageplace { position: relative; display: flex; justify-content: center; align-items: center; top: 0; width: 10%; /*increase size of image*/ } .green .text { margin-left: 0; } Support me by pressing 👍 if this useful for you Thanks for your answer, @bangank36. It kind of works, but when the screen width gets smaller, the image becomes tiny. I'm attaching a screenshot: Link to comment
tuanphan Posted September 23, 2022 Share Posted September 23, 2022 On 9/22/2022 at 1:25 AM, Phobic78 said: Thanks for your answer, It kind of works, but when the screen width gets smaller, the image becomes tiny. I'm attaching a screenshot: It looks fine to me. Which screen size/or device do you see problem? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Phobic78 Posted September 23, 2022 Author Share Posted September 23, 2022 13 minutes ago, tuanphan said: It looks fine to me. Which screen size/or device do you see problem? Thanks, @tuanphan and @bangank36, it does seem to work now. I'm not sure why the image was resizing for me before. I cleared my browser cache and restarted the laptop and it works now. The only thing is that the image aligns to the top of the container (see the screenshot). Is there any way that I can vertically align it to the centre? Link to comment
tuanphan Posted September 24, 2022 Share Posted September 24, 2022 23 hours ago, Phobic78 said: t does seem to work now. I'm not sure why the image was resizing for me before. I cleared my browser cache and restarted the laptop and it works now. The only thing is that the image aligns to the top of the container (see the screenshot). Is there any way that I can vertically align it to the centre? Try adding this to Design > Custom CSS .imageplace { top: 50%; transform: translateY(-50%); } Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care 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