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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:50:30+00:00 2026-06-11T22:50:30+00:00

I have a horizontal layout with width: auto and height: 100%, but the body

  • 0

I have a horizontal layout with width: auto and height: 100%, but the body or container doesn’t stretch to keep the aspect ration of my image.

I need the layout to be like this seen in this attached image:

enter image description here

I will use these images as a background of the panel divs.

Here is my code:

HTML

 <body>
      <div id="cover" class="panel">
      <img src=""/>
      </div>
      <div id="panel1" class="panel">
      <img src=""/>
      </div>
      <div id="panel2" class="panel">
      <img src=""/>
      </div>
      <div id="panel3" class="panel">
      <img src=""/>
      </div>
      <div id="panel4" class="panel">
      <img src=""/>
      </div>
 </body>

CSS

* {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    width: auto;
    height: 100%;
}

.panel {
    width: auto;
    height: 100%;
    float: left;
}

.panel img {
    width: auto;
    height: 100%;
    z-index: -1;
}

You can also see it at this jsfiddle.

I floated the .panel to the left so it will display it all horizontally, but the container is not accomodating the width of all the panels, they just stack on top of each other.

Note: I don’t want to have a fixed with, I need it to be responsive.

Here’s an example of what I want to accomplish (jsfiddle).

As you can see there’s no vertical scrollbar only the horizontal scrollbar is showing and when you resize the viewport the images adjust its width and height and keeps its aspect ratio.

  • 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-06-11T22:50:32+00:00Added an answer on June 11, 2026 at 10:50 pm

    Here’s an update of your original fiddle:
    http://jsfiddle.net/rsPRz/45/

    Trying to stay as close to your original code as possible…

    HTML

    <html>
    <body>
        <img src="http://i978.photobucket.com/albums/ae265/horizoncars/lambo-cover.jpg"
        /><img src="http://i978.photobucket.com/albums/ae265/horizoncars/lambo-left-2.jpg"
        /><img src="http://i978.photobucket.com/albums/ae265/horizoncars/lambo-left-1.jpg"
        /><img src="http://i978.photobucket.com/albums/ae265/horizoncars/lambo-right-1.jpg"
        /><img src="http://i978.photobucket.com/albums/ae265/horizoncars/lambo-right-2.jpg"/>
    </body>
    </html>
    

    CSS

    * {
        margin: 0;
        padding: 0;
        height: 100%;
    }
    
    body {
        overflow-x: scroll;
        overflow-y: hidden;
        white-space:nowrap;
    }
    
    img {
        display: inline-block;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following layout: <Grid Width=1024 Height=768 Background={StaticResource WindowBackground} > <Grid.RowDefinitions> <RowDefinition Height=*></RowDefinition>
I have the next layout <Grid> <Grid.RowDefinitions> <RowDefinition Height=Auto /> <RowDefinition Height=Auto /> </Grid.RowDefinitions>
I have a layout with about 20 horizontal progress bars. Each of them is
I have a layout with three elements and its orientation is 'horizontal' I want
I have this layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent android:background=#222222 android:gravity=center_horizontal android:layout_gravity=center_horizontal android:paddingBottom=5dp> <SeekBar
I am trying to learn and use html5 and have a basic layout but
i have a few problems setting up a layout with horizontal sections that should
I'm trying to achieve a simple layout of 4 horizontal inline-blocks within a container.
I have a set of buttons in a horizontal layout. I have set an
I have a Horizontal Layout in which some vertical layouts are dispatched. I want

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.