x

Image Size in Relation to Browser Size

I'm looking to keep a few images on my site consistent as the browser window changes. Ideally the images should "shrink" to a certain size as the browser gets smaller. For example:

Images looks fine here:
image

But as soon as I drag the browser window to be slighty smaller, these images expand and get misaligned:image

Any advice to overcome this? I have thought about making these images a single image in Photoshop and perhaps that might help. 

Thanks, 

Caroline

995 Views
Message 1 of 5
Report
1 Best Answer

Best Answer

@caroblahblah You're almost certainly placing your three logo images side by side with different alignments to keep them reasonably close to one another. This is one of those areas where Weebly's drag-and-drop into columns content arrangement is not helpful (another example of this is when you wish to place two buttons side by side - again, using Weebly columns produces fairly terrible results when you change the screen size).

In your case, you'll want to upload your three images to your site's Assets folder and then reference them using html. This is actually not hard to do even if you can't spell "html."

  1. Upload your image files to the Assets folder: In the Site Editor, click Theme then click the "Edit HTML/CSS" button at the bottom of the left-hand sidebar.
  2. Scroll down the left-hand sidebar of the Code Editor until you see the "Assets" label. To the immediate right of that will be a "+" sign - click that and select "Upload file(s)" and then browse to the location on your hard drive where your files are (you can select all three in one go). Click the "Open" button in the file browser dialog to upload your files. Click the blue "Save" button in the upper-right corner of the page to return to the Site Editor.
  3. Drag a code element to the location where you'd like your images. Insert the code below. The "Edit HTML" dialog additionally allows you to change the justification of whatever you code so change this from the default left-justification to center-justification.
<img src="/files/theme/logo-ms365.jpg" style="max-height:100px;margin:0 5px;" alt="Microsoft 365 Certified">
<img src="/files/theme/logo-imdb.jpg" style="max-height:100px;margin:0 5px;" alt="IMDb" >
<img src="/files/theme/logo-dante.jpg" style="max-height:100px;margin:0 5px;" alt="Dante Certified">

Of course, you'll change the image filenames from those above (e.g., logo-ms365.jpg) to the filenames you actually use for each image. The style attributes set the maximum height of each image to 100 pixels each. Change this to a height that makes sense for your logo images (the image widths will automatically scale to the indicated height). Note that you could also switch this attribute to "max-width" in which case the height will auto-scale. It's your choice depending on how you want the image stack to visually appear. The margin attribute will add left and right margins to each image in the amount of 5 pixels. Change this depending on how far apart you'd like the images.

Generally speaking, a horizontal logo stack like this typically has smaller images that don't need to wrap on mobile screens so you don't have to add any additional code to handle image wrapping in this case (the logos should remain in a horizontal stack even on your phone screen).

View Best Answer >

986 Views
Message 6 of 5
Report
4 REPLIES 4

Best Answer

@caroblahblah You're almost certainly placing your three logo images side by side with different alignments to keep them reasonably close to one another. This is one of those areas where Weebly's drag-and-drop into columns content arrangement is not helpful (another example of this is when you wish to place two buttons side by side - again, using Weebly columns produces fairly terrible results when you change the screen size).

In your case, you'll want to upload your three images to your site's Assets folder and then reference them using html. This is actually not hard to do even if you can't spell "html."

  1. Upload your image files to the Assets folder: In the Site Editor, click Theme then click the "Edit HTML/CSS" button at the bottom of the left-hand sidebar.
  2. Scroll down the left-hand sidebar of the Code Editor until you see the "Assets" label. To the immediate right of that will be a "+" sign - click that and select "Upload file(s)" and then browse to the location on your hard drive where your files are (you can select all three in one go). Click the "Open" button in the file browser dialog to upload your files. Click the blue "Save" button in the upper-right corner of the page to return to the Site Editor.
  3. Drag a code element to the location where you'd like your images. Insert the code below. The "Edit HTML" dialog additionally allows you to change the justification of whatever you code so change this from the default left-justification to center-justification.
<img src="/files/theme/logo-ms365.jpg" style="max-height:100px;margin:0 5px;" alt="Microsoft 365 Certified">
<img src="/files/theme/logo-imdb.jpg" style="max-height:100px;margin:0 5px;" alt="IMDb" >
<img src="/files/theme/logo-dante.jpg" style="max-height:100px;margin:0 5px;" alt="Dante Certified">

Of course, you'll change the image filenames from those above (e.g., logo-ms365.jpg) to the filenames you actually use for each image. The style attributes set the maximum height of each image to 100 pixels each. Change this to a height that makes sense for your logo images (the image widths will automatically scale to the indicated height). Note that you could also switch this attribute to "max-width" in which case the height will auto-scale. It's your choice depending on how you want the image stack to visually appear. The margin attribute will add left and right margins to each image in the amount of 5 pixels. Change this depending on how far apart you'd like the images.

Generally speaking, a horizontal logo stack like this typically has smaller images that don't need to wrap on mobile screens so you don't have to add any additional code to handle image wrapping in this case (the logos should remain in a horizontal stack even on your phone screen).

987 Views
Message 6 of 5
Report

@PaulMathews thanks so much for this great response. For someone like me who only digs deep into Weebly/HTML about once a year, this is exactly the insight I needed. 

I'll be giving this a shot over the weekend and will post any findings for reference. Thanks again.

972 Views
Message 6 of 5
Report

In case anyone is following along at home, this solution totally worked. 

I ended up linking my images to external websites. A sample of what that final code looks like below: 

<a href="https://www.website1.com/" target="_blank"><img src="/files/theme/logo1.png" style="max-height:100px;margin:0 5px;" alt=“logo1”></a>

Remember to change out website, image file name, and alt text. The target="_blank" opens the link in a new window. 

955 Views
Message 6 of 5
Report
Square

Thank you for sharing that, @caroblahblah!

951 Views
Message 6 of 5
Report
This thread has been archived and locked. Please start a new thread if you would like to continue the conversation.