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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:55:47+00:00 2026-05-27T01:55:47+00:00

im in the process of building a slider and i have a problem with

  • 0

im in the process of building a slider and i have a problem with the styling ,

I have 3 layers of divs ,

  1. First div to set the width and height of the slider
  2. second div to be container of the content , on this div i do all the action
  3. Content divs

First there is a live example with the code : http://jsbin.com/efuyix/8/edit#javascript,html,live

Or here :

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
  function animate(element) {
  var start = new Date();
  var id = setInterval(function() {
    var timePassed = new Date() - start;
    var progress = timePassed / 600;
    if (progress > 1) progress = 1;
    element.style.marginLeft = -50 * Math.pow(progress, 5)+"px";
    if (progress == 1) {
      clearInterval(id);
    }
  }, 10);
}
</script>
<style type="text/css">
  #slider {
    overflow: hidden;
    width: 50px;
    height: 50px;
  }
  #container {
    min-width: 100px;
    height: 50px;
    float:left;
   }
  .content {
    width: 50px;
    height: 50px;
    float:left;
   }
</style>

</head>
 
<body>
 <div id="slider">
  <div id="container" onclick="animate(this)">
    <div class="content" style="background-color:blue;"></div>
    <div class="content" style="background-color:pink;"></div>
    <div style="clear:both;"></div>
  </div>
</div>
</body>
</html>

So , what is the problem?

the width of the Container div must be big enough to contain all the Content divs perfectly ,

for example if i have 3 divs of Content inside the Container , i need the Container to be at least set with 150px width (because the Content div width is 50px) else it will be messing up and line break

If the Container is not big enough , the Contents divs will line break and all the slider will be messed up , must to know is that i don’t know how many Content divs will be print into the Container div , so the Container div must contain all of them without line breaking and somehow to be dynamic

how can i fix it? thank you in advance!!

  • 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-27T01:55:47+00:00Added an answer on May 27, 2026 at 1:55 am

    On .content, replace float: left with display: inline-block.

    Then, add white-space: nowrap to #container.

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

Sidebar

Related Questions

During the process of building software applications, you would start testing what you have
In the process of building an RPM package, I have to specify the BuildRoot
I am in the process of building a large asp.net Mvc project and have
in the process of building an app, I have an Activity lets call it
I'm in the process of building a sports team app and have created my
I have a play application which I am in the process of building a
I'm in the process of building and designing my first Javascript OOP web application
I'm in the process of building my first real WPF application (i.e., the first
In the process of building an operator application in C# I have encountered some
Hi We are in process of building new application which will have .Net UI

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.