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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:08:42+00:00 2026-06-01T03:08:42+00:00

How can I remove the unwanted whitespace in following example? Note 1. that there

  • 0

How can I remove the unwanted whitespace in following example?

Note 1. that there should not be any red color, because #red is parent of two other #green and #blue.

Note 3. both #green and #blue have unknown height.

Note 2. #blue have an extera “top: -10px” css property, so it comes 10px up, but the parent element(#red) will not resize verticaly to fit new positions

<html>
<head>
<style>
    #red{width: 500px;background: red;height: auto;}
    #green{width: 500px;background: green;position: relative;float: left;}
    #blue{width: 500px;background: blue;top:-7px;position: relative;float: left;}
    .clear{clear: both;}
</style>
</head>
<body>
    <div id="red">
        <div id="green">Green<br>Green<br>Green<br>Green<br>Green</div>
        <div id="blue">Blue<br>Blue<br>Blue<br>Blue<br>Blue</div>
        <div class="clear"></div>
    </div>
</body>
</html>
  • 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-01T03:08:43+00:00Added an answer on June 1, 2026 at 3:08 am

    I don’t understand why you are floating things which are the same width as the parent. Also, using position: relative here is not at all necessary. Here’s a much simpler way to achieve exactly what you are talking about:

    <div id="red">
        <div id="green">
            Green<br>Green<br>Green<br>Green<br>Green
        </div>
        <div id="blue">
            Blue<br>Blue<br>Blue<br>Blue<br>Blue
        </div>
    </div>​
    
    #red{
        width: 500px;
        background: red;
        height: auto;
    }
    #green{
        background: green;
    }
    #blue{
        background: blue;
        margin-top: -7px;
        /* Necessary so the text in #green doesn't appear over the blue background */
        position: relative;
        z-index: 100;
    }
    

    View the jsFiddle.

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

Sidebar

Related Questions

Is there a way I can remove the background bar image in the SeekBar
Any one can share the mainfest.xml. How to set it? then can remove the
Wordpress has a filter that automatically add paragraphs to posts. I can remove this
can we remove history points created in web browser. or is it possible not
I have a usercontrol that can be used in for example a gridview itemtemplate,
I am currently using the following as my external print.css file: /* Remove unwanted
I'm trying to remove some unwanted whitespace from JavaScript files, and combine files using
I need a regex or function that can remove the ENCODED HTML tags from
One can remove all calls to printf() using #define printf . What if I
I was wondering if when using the datagridview control you can remove the thing

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.