Jump to content

How to show different embed blocks on mobile and pc?

Recommended Posts

Site URL: https://oautima.squarespace.com/admin-test

Hello,

I have a problem with embedding html5 partner ads. Some of the ads are 700px wide or more, so when the web is used on a mobile device the ads are too wide and web is not user friendly. On the other hand, when opened on pc, ads which are narrower, around 300px look to small for  the screen. 

Is there any CSS or something else which could allow me to post both ads in my blogpost and than, according to the device on which the webpage is opened the appropriate ads are displayed. 

 

Link: https://oautima.squarespace.com/admin-test

Pass: fanta123

So I would like first and the second ad to be on a PC, and third, fourth and fifth on mobile device.

Thanks in advance!

Link to comment
  • Replies 6
  • Views 1.2k
  • Created
  • Last Reply

I have made some progress.

Using this code:

@media only screen and (max-width: 768px) {#block-7c650aa4296c696a3798 {display: none;}

}

@media only screen and (min-width: 768px) {#block-7c650aa4296c696a3798 {display: none;}

}

I managed to hide embed boxes for desktop from mobile and vice versa.

But, my question now is:

Is there any code or something that could do this automatically?

With this one I have to copy paste #block for every embed box from "inspect element" on chrome.  

Link to comment

Yes. I would like  for mobile ads to be in 300x250px and pc ones to be in 728x90px. 

The thing is that I do not have banners which change according to the screen size, but they are fixed in the size in which they are supplied to me. 

So I have to publish both of them and then hide small one from pc and big one from mobile.

Thanks!

Link to comment
On 5/1/2021 at 4:33 PM, oautima said:

Yes. I would like  for mobile ads to be in 300x250px and pc ones to be in 728x90px. 

The thing is that I do not have banners which change according to the screen size, but they are fixed in the size in which they are supplied to me. 

So I have to publish both of them and then hide small one from pc and big one from mobile.

Thanks!

fanta123

incorrect password. Can you check it again?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.