Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

Device specific HTML lines


Recommended Posts

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!

F944759E-BA0D-4EA0-B7D7-CC51CDFC8DA4_1_105_c.jpeg

Screen Shot 2020-12-07 at 5.36.49 PM.png

Link to post
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Posts

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 h

@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_

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.

Posted Images

@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

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement, Enable Pinch/Zoom on lightboxGeolocation Automatic Currency Converter, Sortable Table from GSheet
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to post
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.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...