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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:57:39+00:00 2026-06-14T20:57:39+00:00

I have a container with background color green. Inside that green <div> , I

  • 0

I have a container with background color green. Inside that green <div>, I have a <div> which is black and styled as a box (50px x 50px) – this <div> is floated to the left.

Now if I add a <p> to my markup after the grey <div>, I’d expect it to float around the grey <div>. And it does. However, when I substitue

with another <div> which is styled as box (set height and width), it doesn’t float around anymore, but disappears behind the floating div.

Even if I have first paragraphs which are floating around correctly and THEN I add the div (box), the paragraphs stop floating around and appear on another line.

HTML:

<div id="greencontainer">
    <div id="blackbox"></div> <!--this one is float:left;-->
    <p>A paragraph that floats around the previous div</p>

    <div id="anotherbox"></div> <!-- if I add another div with set width and height, it disappears behind the floated one, and even prevents the paragraph from floating around.-->
</div>

CSS:

#blackbox {
    width:50px;
    height:50px;
    background-color:black;
    float:left;
}

#p {
    margin:0px;
    padding:0px;
}

#anotherbox {
    width:50px;
    height:50px;
    background-color:grey;
}
  • 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-06-14T20:57:40+00:00Added an answer on June 14, 2026 at 8:57 pm

    Actually, part of the <p> itself, which is a block box, is also hiding behind your first <div>. That’s because it’s not being floated, so it’s being laid out in normal flow as if the first <div> was not there, because floating a box takes it out of normal flow.

    Your <p> contains inline content (its text), however that inline content is able to flow around your first <div>, because inline content is made that way. It’s why you’re able to align an image to the left or right and text is able to flow around it without the image being in the way.

    Your second <div>, like your <p>, isn’t floated, so again it’s being laid out in normal flow as if your first <div> wasn’t there. Since both of them have the same dimensions, it looks as if one is completely hidden behind the other.

    In your code you have the second <div> coming after the <p>, so it shouldn’t affect the text. However if you meant to add it before the <p>:

    <div id="greencontainer">
        <div id="blackbox"></div>
        <div id="anotherbox"></div>
        <p>A paragraph that floats around the previous div</p>
    </div>
    

    Then, upon reading my explanation above, the reason the text stops flowing around the first <div> becomes obvious: because your second <div> is in the way, hidden behind the first one. It’s that second element that’s pushing your <p> down.

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

Sidebar

Related Questions

I have this html and CSS: <div style=background-color:Red; width:200px; height:200px;> <div style=background-color:Blue; width:50px; height:50px;
Suppose I have a li styled as follows: #app-container ul.apps li.app1 { border-color:#57b6dd; background:url(app-icons/app1.png)
I have a container (div) with a background image. In this div there is
I have a big <div /> container that has an image as a background.
I have a container with the background-color set with CSS. In this container there
I have a div that has a background colour and it also contains an
I have a <div> which contains a background image, the <div> sits within a
I have the following css code .container { width:800px; background-color:yellow; margin:auto; display:table; } .cell
I have this jQuery and HTML http://jsfiddle.net/UgX3u/30/ <div class=container> <div class=yellow></div> <div class=red></div> <div
In a big div I have search box which basically is a div having

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.