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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:36:33+00:00 2026-05-23T14:36:33+00:00

I need the center div div#b to fill out the gab between div#a and

  • 0

I need the center div div#b to fill out the gab between div#a and div#c.

<div id="a">
    <span>Div1</span>
</div>
<div id="b">
    <span>Div2</span>
</div>
<div id="c">
    <span>Div3</span>
</div>

I tried to do this by placing width: 100% on div#b but without luck.

div
{
    border:1px solid red;
}
div#a
{
    float:left;
    width:50px;
}
div#b
{
    float:left;
    width:100%; ?? <!-- Doesn't work!!! -->
}
div#c
{
    float:right;
    width:50px;
}

How can I get div#b to expand from div#a to div#c?

There can be no line breaks.

  • 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-23T14:36:33+00:00Added an answer on May 23, 2026 at 2:36 pm

    CSS3

    You can implement this dynamic behavior using the CSS3 Flexible Box Layout Module:

    <style type="text/css">
        div.Container
        {
            width: 100%;
            display: box;
            display: -moz-box;
            display: -ms-box;
            display: -webkit-box;
        }
        div.B
        {
            background: magenta;
            box-flex: 1;
            -moz-box-flex: 1;
            -ms-box-flex: 1;
            -webkit-box-flex: 1;
        }
    </style>
    
    <div class="Container">
        <div style="width: 50px; background: cyan;">
            A
        </div>
        <div class="B">
            B
        </div>
        <div style="width: 50px; background: yellow;">
            C
        </div>
    </div>
    

    A new version of FireFox, a new version of Google Chrome, Internet Explorer 10 and a new version of Safari supports CSS3 flexible box layout. Internet Explorer 9 and Opera is lacking support at the moment.

    I also want to mention this new way to do it in FireFox:

    <div style="float: left; width: 50px; background: cyan;">
        A
    </div>
    <div style="float: left; width: -moz-calc(100% - 100px); background: magenta;">
        B
    </div>
    <div style="float: left; width: 50px; background: yellow;">
        C
    </div>
    

    FireFox is the only browser that support the calc function at the moment.


    CSS2

    Here is the old way to do it:

    <div style="padding-left: 100px;">
        <div style="float: left; width: 50px; margin-left: -100px; background: cyan;">
            A
        </div>
        <div style="float: left; width: 100%; margin-left: -50px; background: magenta;">
            B
        </div>
        <div style="float: left; width: 50px; background: yellow;">
            C
        </div>
    </div>
    

    A width of 100% inside the container div is the width of the container minus the 100px left padding. Then there is room for the left and right 50px div elements. Then you have to position them using some negative margin and floating.


    Feature detection

    Use feature detection with Modernizr. Then you can use CSS2 for browsers that lack support for CSS3 flexbox.

    If you do .NET development you can download Modernizr with NuGet.

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

Sidebar

Related Questions

I need to center some text inside a <div> or <span> tag. I've set
I need to center a image of width 1400px inside a width 960px div,
Possible Duplicate: How to center div horizontally and vertically I need to put image
I need to center a CSS menu that has an unknown width. I found
I need to center align a horizontal menu. I've tried various solutions, including the
I need to center html content inside a div class=partners (top div with 2
i need to center the navigation links inside the div, and align it horizontally.
Is it possible to have a div center aligned (ie) always i need to
Please help me center a div that does not have a predefined width, inside
My web page sits in a DIV that is 960px wide, I center this

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.