Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
Sign in to follow this  
Joe Barefoot

Can I control the size of images on mobile devices?

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.

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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!

Share this post


Link to post

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!

Share this post


Link to post

Create an account or sign in to comment

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

Sign in to follow this  

×
×
  • Create New...