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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:23:59+00:00 2026-05-28T05:23:59+00:00

i have one div that contain three div for a part in my website

  • 0

i have one div that contain three div for a part in my website
code is like this:

<div id="container">
<div ></div>
<div id="div1"></div>
<div id="div1"></div></div>

in css :

#container {
margin: 0 auto;
width: 950px;
opacity: .5;
filter: alpha(opacity = 50);
background: #fff;}

#div1 {
width: 100%;
height: 30px;
background: black;
float: left;}

#div2 {
margin:50px 0 50px 0;
width: 950px;
float: left;}

#div3 {
border: 1px solid black;
width: 437px;
height: 532px;
margin: 18px;
float: left;}

when i remove the float:left form the #container
then it’s height will not be zero using firefox
but when i add it back,it’ll work correctly but i can not center the boy in browser window.

how can i fix this?

  • 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-28T05:23:59+00:00Added an answer on May 28, 2026 at 5:23 am

    Use a clear div. That will allow your container to adapt to the height of the floated elements. Also you had some errors in your CSS.

    “#.” is not how you declare an ID.

    Additionally, the ID in your HTML needs to match the ID in your CSS 100%, case sensitive. In your HTML you had id="contianer", but in your css, #container

    .clear {
        clear:both;
        display:block;
        overflow:hidden;
        visibility:hidden;
        width:0;
        height:0!important
    }
    
    #container {
        margin: 0 auto;
        width: 950px;
        opacity: .5;
        filter: alpha(opacity = 50);
        background: #fff;
    }
    #div1 {
        width: 100%;
        height: 30px;
        background: black;
        float: left;
    }
    
    #div2 {
        margin:50px 0 50px 0;
        width: 950px;
        float: left;
    }
    
    #div3 {
        border: 1px solid black;
        width: 437px;
        height: 532px;
        margin: 18px;
        float: left;
    }
    
    <div id="container">
        <div ></div>
        <div id="div1"></div>
        <div id="div2"></div>
        <div class="clear"></div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function in Javascript that moves one div depending on the mouse
I have a main parent div that is .resizable(). One of it's child divs,
I have a site that has 2 DIV tags, one floats left the other
I have website, usually all looks fine but sometimes one div is on the
I have a page that has three divs one at the top, one at
I have a section of Razor code in one of my views that isn't
i am using JSOUP and I have html/text something like: <html><head><style type=text/css> </style></head> <body><div
I have written code that automatically creates CSS sprites based on the IMG tags
I have a jquery mobile app that has a page. This page has three
I have one large div with one smaller div inside it. The smaller div

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.