Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:05:51+00:00 2026-05-30T01:05:51+00:00

I’ve stumbled into a tiny problem, which, for some reason, i have no idea

  • 0

I’ve stumbled into a tiny problem, which, for some reason, i have no idea how to solve. It might be one of those cases where it just looks simple, but impossible to implement. Here’s the problem:

  • i’d like to add a few images next to each other in one div. they need to have no spacing in between
  • the div has a percentage width set so as it reaches some point i’d like those images to start to get smaller. What happens now is the images simply fall down vertically when the div can’t contain them any longer.

The trick to get the images to scale down is by adding img { max-width: 100%; } in the css file, but that wouldn’t work in this case. I’d like to ask if anyone knows an easy solution for this problem? I could try to set max-width for each image to a different number depending on their widths but i’m affraid the calculations will be off in some browsers (we all know how some browsers treat percentages with decimal places).

Thanks in advance

Non-working example:

<div style="width:40%"><img src="img1.jpg" /><img src="img2.jpg" /></div>
CSS: img { max-width: 100%; }

Comments: This is perfect for a single image so i’m looking for something as simple for multiple images.

Working example:

<div style="width:40%"><img src="img1.jpg" style="width:47.88%" /><img src="img2.jpg" style="width:52.12%" /></div>

Comments: calculating percentage widths is a pain and i’m not sure if it will even work in all cases.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:05:53+00:00Added an answer on May 30, 2026 at 1:05 am

    I think you’ll be fighting an uphill battle if you try to do this all within a single div. An easy, reliable solution is to use a table. You could also do it with a bunch of divs that approximate a table.

    http://jsfiddle.net/chad/uSrYx/ – tables

    http://jsfiddle.net/chad/uSrYx/1/ – divs masquerading as tables

    http://jsfiddle.net/chad/uSrYx/2/ – a slightly different effect with inline-block divs inside of a white-space:nowrap container. Only possible if you know how many images are on each row beforehand

    It all depends on how you want this to degrade in older browsers. Using a table will keep everything on the same line, but that line’s width with not scale down. Using divs will stack the images vertically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.