DangDang Posted January 18 Share Posted January 18 (edited) I'm working on a site where I want different text sections to show depending on whether it's displayed on mobile or desktop. To achieve this, I use code from @tuanphan found on this forum: /* Hide this on Mobile */ @media screen and (max-width:767px) { section[data-section-id="65a90fba666ba066ad4a4ee9"]{ display: none; } } /* Hide this on Tablet - Desktop */ @media screen and (min-width:768px) { section[data-section-id="65a90ce4531574783e83ad15"] { display: none; } } In both cases, it works to hide one of the sections for the media format in case. However, on desktop, it also causes the text section to move up into the header space (see screenshots, the lower one is a reference for how the rest of the projects looks, which is how I want it) - something that hasn't been an issue before on the site. What might the problem be here? The mobile version looks good. Edited February 28 by DangDang Link to comment
Solution Ziggy Posted January 18 Solution Share Posted January 18 This is probably happening because there is padding applied to the first section on any page to give space for the header. It may improve the situation to swap the sections around to put the desktop section at the top. You could also add a couple of rows to the top of the mobile section (on the mobile view) to account for that lack of padding. DangDang 1 Please like and upvote if my comments were helpful to you. Cheers! Zygmunt Spray Squarespace Website Designer Contact me: https://squarefortytwo.com ☕ Did I help? Buy me a coffee? 🔌 Ghost Squarespace Plugins (Referral link) 📈 SEO Space (Referral link) ⬛ SquareWebsites Plugins (Referral link) 🔲 SQSP Themes (Referral link) ✨ Spark Plugin (Referral link) Link to comment
DangDang Posted January 19 Author Share Posted January 19 17 hours ago, Ziggy said: You could also add a couple of rows to the top of the mobile section (on the mobile view) to account for that lack of padding. Yes, that's what I ended up doing! Switching the sections so the mobile version moved up into the header space, and added three rows in the top of the section 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