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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:19:11+00:00 2026-05-10T21:19:11+00:00

I keep finding that if I have nested divs inside each other, and one

  • 0

I keep finding that if I have nested divs inside each other, and one of the inner ones is floated, the outer one won’t expand around it.

Example:

<div style='background-color:red; '>     asdfasdf     <div style='float:left; background-color:blue; width:400px; height:400px;'>         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />         asdfasdfasdfasdfasdfasdfasdf<br />     </div>     asdfasdf </div> 

What do I need to do to the outer div to make it cover the inner one? IE: Put it’s border/background color all the way around it?

Also, is there a general principle I am bumping up against here? If so, what should I look up to get a solid understanding of what it is?

Thanks!

Edit

Hi All,

Thanks for the answers, semantically correct and no, and for the links.

Though I will end up using overflow in the final work, I will leave Ant P’s answer as accepted, as it was the first one that really worked, and got me out of a short term jam, even though it offends semantic sensibilities.

As a long-time html hack trying to move to decent css layouts, I can certainly understand, and sympathize with, using semantically incorrect hack that gets the job done, though I am sure he will change that habit after this =o)

  • 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. 2026-05-10T21:19:12+00:00Added an answer on May 10, 2026 at 9:19 pm

    You can do it strictly with CSS using overflow:hidden

    <div style='background-color:red;overflow:hidden;'> ... </div> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery game that my members keep finding ways to win. It's
Currently I'm finding I have to keep duplicating partials for different modules. I would
Apologies for this trivial question, I'm new to WPF and keep finding blogs that
I keep finding some JavaScript that looks like the example below. Can someone explain
I have a several branches in my repository and I'm finding that over time
I have a ListView that I'm populating with names and images (if one exists)
So this is more of a generic question. I seem to keep finding myself
Keep in mind that I'm not looking for a list of current browsers to
Keep going around circles, but I am still unclear about this. Have a feeling
I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?

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.