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 426959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:31:53+00:00 2026-05-12T19:31:53+00:00

How may I display two images on a website with elastic layout, side by

  • 0

How may I display two images on a website with elastic layout, side by side which will autoscale to 50% of parent containter?

I was playing with it last night but didnt went too far.

When I went with divs, they overlaped each other or second image was displayed underneath first.

When I went with table, table become wider than screen resulting in vertical scroll bar.

I dont know in advance what size image is, nor what resolution user is having, idealy I would set this up purely by css, without using javascript.

I had luck on other page with single image autoscaling to fit in container by setting max-width:90% but I can’t apply this trick here. Funny thing is, it this scenario max-width is set according to window (parent element), while in examples above max-width is set according to width of image itself.

Sorry for my english, if something is not clear, please ask.

Thanks

  • 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-12T19:31:53+00:00Added an answer on May 12, 2026 at 7:31 pm

    I see what you’re saying. I had a problem with them being just a little bit too wide, so I took a little off of the margin, since it wouldn’t take a fraction in the percent sign. See if this will do the trick:

    <html>
    <head>
    <style>
    div {
     width: 80%;
     background: #acf;
    }
    div img {
     width: 50%;
     padding: 0;
     margin: 0 -0.2em 0 0;
    }
    </style>
    </head>
    <body>
    
    <div>
     <img src='a.jpg' />
     <img src='b.jpg' />
    </div>
    
    </body>
    </html>
    

    Edit: Or even better, if all you have are the images in the box, don’t let it wrap at all:

    <html>
    <head>
    <style>
    div {
     width: 80%;
     background: #acf;
     white-space: nowrap;
     overflow: visible;
    }
    div img {
     width: 50%;
     padding: 0;
     margin: 0;
    }
    </style>
    </head>
    <body>
    
    <div>
     <img src='a.jpg' /><img src='b.jpg' />
     <!-- Don't put a space between the images. -->
    </div>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an application which is mainly a webview and will display a JQTouch
I am looking for a way to display two png images (in fact, it
How do you undim the display programmatically? I may compile upto 100 times a
May i know how could i edit the style of description of the images
May I know what is the difference between the two in java? I am
I have two tables: Users and Roles. A user may have more roles, so
I have a bunch of hidden images on my website. Their container DIVs have
I have two images. The first one is of background noise + content, and
The script gets the content and images from a blog site. A post may
My web app may display messages from time to time. Some of the messages

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.