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

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here's a wiki timeline of all programming languages. I would… May 12, 2026 at 12:33 am
  • Editorial Team
    Editorial Team added an answer Do not use such loop with sleep, it will block… May 12, 2026 at 12:33 am
  • Editorial Team
    Editorial Team added an answer INSERT INTO CategoryMaster (CategoryID, CategoryText) SELECT %d,'%@' WHERE NOT EXISTS… May 12, 2026 at 12:33 am

Related Questions

I'm just beginning to use Regex so bear with my terminology. I have a
I have an web application with a dynamic number of tabs ranging between 2
I'm a little surprised that there isn't some information on this on the web,
I know this is a basic questing but I am just not finding a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.