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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:18:43+00:00 2026-05-25T13:18:43+00:00

Why is it that when I have three boxes in a div without floating

  • 0

Why is it that when I have three boxes in a div without floating them, the outer div wraps around them, but when I add the float, the outer div collapses?

<html>
<head></head>
<body>
<style>
#OuterWrapper {
    height: 100%;
    width: 200px;
    border: 1px BLACK dotted;
    text-align: left;
}

.Box {
    float: left; // remove this float and the outer wrapper wraps the three boxes
    height: 50px;
    width: 50px;
    background: BLUE;
    border: 1px WHITE SOLID;
}
</style>
<div id="OuterWrapper">
    <div class="Box"></div>
    <div class="Box"></div>
    <div class="Box"></div>
</div>
</body>
  • 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-25T13:18:43+00:00Added an answer on May 25, 2026 at 1:18 pm

    That is because floating elements doesn’t affect the size of the parent element. You can use the overflow style to make the element contain the children.

    Also: You should have a doctype tag so that the page isn’t rendered in Quirks Mode. Your style element should be in the head element. The </html> tag was missing.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <style type="text/css">
    #OuterWrapper {
        width: 200px;
        border: 1px BLACK dotted;
        text-align: left;
        overflow: hidden;
    }
    
    .Box {
        float: left;
        height: 50px;
        width: 50px;
        background: BLUE;
        border: 1px WHITE SOLID;
    }
    </style>
    </head>
    <body>
    <div id="OuterWrapper">
        <div class="Box"></div>
        <div class="Box"></div>
        <div class="Box"></div>
    </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three select boxes. <div style='float: left; padding-right: 10px;'> <select size=10 name=company_id> //
WinForms have those three boxes in the upper right hand corner that minimize, maximize,
So I have a div tag to sort of draw boxes around various sections,
I have an application that generates div boxes dynamically. The boxes are overlapping each
I have a function that dynamically creates div boxes and put an event on
I have a set of three combo boxes (drop downs) that are populated by
Original Problem: I have 3 boxes each containing 200 coins, given that there is
I have three unordered lists that have been created as Scriptaculous Sortables so that
I have three classes that all have a static function called 'create'. I would
Lets just say that I have three textboxes: TextBox1, TextBox2, TextBox3. Normally if I

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.