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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:23:39+00:00 2026-06-15T00:23:39+00:00

This is what I have: http://jsfiddle.net/kRUBY/ <style> div.box { width:400px; height:200px; float:left; } </style>

  • 0

This is what I have:

http://jsfiddle.net/kRUBY/

<style>
div.box {
    width:400px;
    height:200px;
    float:left;
}
</style>

<div style="width:100%; height:200px; overflow:hidden;">

    <div style="width:2000px; height:200px;">
        <div class="box" style="background:red;"></div>
        <div class="box" style="background:blue;"></div>
        <div class="box" style="background:yellow;"></div>
        <div class="box" style="background:orange;"></div>
        <div class="box" style="background:black;"></div>
    </div>

</div>

As the page is resized, I want the contents of the 2000px div to stay centered, so the yellow colored div is always in the middle of the screen.

Is it possible to do this with only css?

  • 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-15T00:23:41+00:00Added an answer on June 15, 2026 at 12:23 am
    <div style="width:100%; height:200px; overflow:hidden;">
        <div style="width:2000px; height:200px;position: relative; left: 50%; margin-left: -1000px">
            <div style="width:400px; height:200px; float:left; background:red;"></div>
            <div style="width:400px; height:200px; float:left; background:blue;"></div>
            <div style="width:400px; height:200px; float:left; background:yellow;"></div>
            <div style="width:400px; height:200px; float:left; background:orange;"></div>
            <div style="width:400px; height:200px; float:left; background:black;"></div>
        </div>
    </div>​
    

    Here’s the link

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

Sidebar

Related Questions

I have this code: http://jsfiddle.net/cmF4S/3/ <div style=float: left; position: relative;> <input type=text placeholder=Search... style=float:
I have this script http://jsfiddle.net/gphp/ZMmRv/4/ I have two events: 1 - the div is
I have this jQuery and HTML http://jsfiddle.net/UgX3u/30/ <div class=container> <div class=yellow></div> <div class=red></div> <div
I have this fiddle: http://jsfiddle.net/9J5Fg/ When one box is open and I click on
I have this code : http://jsfiddle.net/Qchmqs/BSKrG/ <div class=step><-- this is darned wrong <div id=step2><a>Darn</a></div>
I have this example: http://jsfiddle.net/WkpL9/ HTML: <div class=span2> <div class=image-container> <img alt= src=http://placehold.it/150x120/> <p>asdadsadasdasdsadasdasdasdasdsadsad</p>
I currently have this code: http://jsfiddle.net/D5EMp/25/ This code fades in/out a div with a
i have this issue http://jsfiddle.net/valerioMassacci/LdCqX/ i have a specific div comments that onclick show
i have this: http://jsfiddle.net/uAQ8B/5/ This list should have all the objects on the left
I have this jsFiddle: http://jsfiddle.net/HMZuh/1/ Which contains this html <div ng-app ng:controller=ShowHideController> <div ng-show='showMe'>

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.