insidefukushima Posted December 8, 2020 Posted December 8, 2020 Site URL: https://insidefukushima.org/home Hello, I'm using page header code injection to add a line of text to a "gallery" page. Unfortunately gallery pages do not allow for text boxes, so I had to use custom HTML lines. I was able to insert the text, however the text does not look good on mobile, so I would like for it to be only visible for desktop users. This is the HTML: <html> <head> </head> <body> <style> div.center { position: fixed; left: 50%; bottom: -21px; transform: translate(-50%, -0%); margin: 0 auto; } </style> <div class="center"> <h2>Click on the information "i" button for photo details.</h2> </div> </body> </html> I know that its possible to use custom CSS to make changes visible to devices within a certain range using "@media screen and (min-width: )", which I used to increase the size of the information button to display media descriptions for desktops only. However, I'm not aware of any way to do this through the page header code injection. Is there any way to make HTML lines device specific through the page header code injection? Perhaps I'm approaching this from the wrong angle. The page that I am talking about is https://insidefukushima.org/home. You can see the text that I added under the image. Thank you!
Beyondspace Posted December 8, 2020 Posted December 8, 2020 @media only screen and (max-width: 640px) { .center { display: none; } } here is sample of how media query working, you can learn a bit from here https://www.w3schools.com/css/css_rwd_mediaqueries.asp BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
insidefukushima Posted December 8, 2020 Author Posted December 8, 2020 1 hour ago, bangank36 said: @media only screen and (max-width: 640px) { .center { display: none; } } here is sample of how media query working, you can learn a bit from here https://www.w3schools.com/css/css_rwd_mediaqueries.asp This worked perfectly, thank you. I was trying to use the "@media only" before but it appears I was not wrapping it with style tags for HTML. I had only previously used it in the custom CSS tool. I will bookmark that page, that is very useful.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.