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

Can I control the size of images on mobile devices?


Go to solution Solved by foleyatwork,

Recommended Posts

I'm wondering if anybody knows a way to control the size of images in an Image Block when displayed on mobile devices.

To be specific, the images are (on large browsers) small mugshots of members of our team. They're inserted on the page one after another and on mobile devices they are scaled to the width of the screen. I'm hoping to make them a bit smaller than this as on iPads and other tablets they become rather intimidating.

Here's the page in question if it's useful:

http://www.superhet.net/about/

Thanks

Edited by acalvo
retag

Assistant at Superhet.

Link to comment
  • Solution

This isn't a native Squarespace 6 option, but if you're handy with coding you could make it happen in developer mode. Just use a media query to target screens below a certain size; it might look something like this:


@media screen and (max-device-width: 480px) {
 img {
   float: left;
   width: 200px;
 }
}

Here's a really great article on using media queries if you'd like to look into this a bit more.

http://www.alistapart.com/articles/responsive-web-design/

Developer Evangelist at Squarespace.

Link to comment

Thank you for your suggestion. Unfortunately it doesn't seem to work! I don't understand why as your CSS seems to make perfect sense. I have read about media queries before but never used one. I assume Squarespace already uses this sort of thing out of the box?

Is it possible something could be conflicting with this code? I have had to use '!important' before to override stubborn Squarespace code.

I tried this sort of thing to get around stubborn code:

@media screen and (max-device-width: 480px) { #block-8253851efba5ab80d69a img { float: left; width: 100px !important; }}

Assistant at Superhet.

Link to comment

Hi Joe,

I actually didn't think that exact code would work, it was more like a suggestions to steer you in the right direction. It's definitely possible some of your theme's code is overriding this rule. You should get a little more specific with your CSS declaration to make sure that doesn't happen - try giving the images an ID and then using that to target the images in the CSS.

-Kevin

Developer Evangelist at Squarespace.

Link to comment
  • 1 year later...
  • 1 year later...

I FOUND IT!!!!! I had the same problem and found NO solution that worked for me! Finally a found a solution myself! instead of using coding, just adapt the image. f.ex. if you had an image 400400 blown up on mobile devices, but perfect on desktop, you add white space to both sides of the images (not within squarespace but with other programs). the result is f.ex. a 800400 image which will result in a PERFECT mobile image. (de dimensions are an example of course)

the images will look smaller on mobile, because the site is using the white space from both sides of the image!

if you do it right, i'm sure it will work for you as well!

Link to comment
  • 11 months later...

Duh! Thank you henrybouci! It worked like a charm!!

I added the white border + resized the photo a little and it's now showing at the size that I wanted. For some reason I thought Squarespace would overrule any resizing but no, it was as simple as that. The white border was fundamental though.

Thanks again!

Link to comment
  • 3 years later...
  • 5 months later...
On 12/29/2019 at 11:04 PM, nestorlaz said:

Hey! I have the same issue. Is it possible to share a link or explain how you did it? 

Thank you in advance

 

If you share link to your site, We can check easier.

Email me if you have need any help (free, of course.). Answer within 24 hours.

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

Create an account or sign in to comment

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

×
×
  • Create New...