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

  • Home
  • SEARCH
  • 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 7568341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:54:02+00:00 2026-05-30T14:54:02+00:00

I have a web page that contains a few <section> s that should be

  • 0

I have a web page that contains a few <section>s that should be laid out horizontally. All are 85% of the screen width, with an automatic margin both sides. The problem is that the sections seem to ignore float:left for some reason.
I also don’t want to set a fixed width on the body, as the same CSS will be used on many pages. Is there a way that this can be done?

Here’s a jsbin of the code. I also tried this with display:box.

  • 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-30T14:54:03+00:00Added an answer on May 30, 2026 at 2:54 pm

    What you can do is to use JS to “resize” a container. here’s a short example:

    <div id="container">
        <div class="section"></div>
        <div class="section"></div>
        <div class="section"></div>
        <div class="section"></div>
    </div>
    

    what you do is float:left all the sections (additionally add overflow:hidden;zoom:1 for the container for wrapping). pretty easy. however, they are constrained by the width of the container (or if it’s directly the children of the body, they are constrained by the html body).

    from here, you use JS to do the trick. I prefer jQuery (but people may criticize for not using pure JS so i will only describe the procedure). What you do is to get the “outer width” of the sections (that is the width, including padding, border AND margins), multiply by how many sections you have, and then apply this to the direct parent/container (or whatever parent that is constraining your horizontal items).

    The effect is that the parent of your sections will have an explicit width, that will force the browser to make it fit, thus be scrollable horizontally. also, make the container fit the sections as well.

    these methods are currently done by JS “sliders” which have a specified width for the the outer container (like 900px) but have an inner container which has like 3 sections (2700px). this, with added overflow:scroll to the outer container makes everything in it “horizontally scrollable”

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

Sidebar

Related Questions

I have a wrapper class that contains all the content on the web page.
I have a ASP.NET web page that contains many textboxes. Each textbox has a
I have a master page that contains an ASP.NET server side Menu control (System.Web.UI.WebControls.Menu)
In a web application, I have a page that contains a DIV that has
I have a web page that contains a textbox and a submit button. When
I have a site a few years old that contains about 30 aspx Web
I have a web page that contains two textboxes and a button. I can't
I have a web page that includes a bunch of images. Sometimes the image
I have a web page that displays a long line graph inside a div
I have a web page that is being displaying in a winform app using

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.