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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:18:08+00:00 2026-06-17T08:18:08+00:00

jsFiddle HTML <div id=a> <div id=b>bbb</div> <div id=c>ccc</div> </div> CSS #a { border: 1px

  • 0

jsFiddle

HTML

<div id="a">
  <div id="b">bbb</div>
  <div id="c">ccc</div>
</div>

CSS

#a {
  border: 1px solid black;
   *zoom: 1;
}
#a:before, #a:after {
   display: table;
    content: "";
    line-height: 0;
}
#a:after {
  clear: both;
}

#b {
  float: left;
  font-size: 36px;
  background-color: blue;
}

#c {
  float: right;
  background-color: red;
}

I want the red box (#c) to be aligned to the bottom-right corner.

If I add position:relative to #a and position:absolute;bottom:0;right:0 to #c it works, but as soon as I add it the blue box as well the container (#a) collapses. I don’t know which is going to be taller, #b or #c so I want to apply the positioning to both of them. The usual clear-fix doesn’t work on absolutely positioned elements.

So how do I position #b to the bottom-left, and #c to the bottom-right without collapsing the container div #a?

  • 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-17T08:18:09+00:00Added an answer on June 17, 2026 at 8:18 am

    Well, this is pretty esoteric solution, but it works 🙂

    Setting both #b and #c inline-block so they work with each other like regular inlines and we can use vertical-align. Then adding text-align:justify; to container and :after with width:100% to pull #b and #c to the left and right sides. Setting font to zero for container (and restore it in inner blocks) to avoid under/over-line and other gaps and set zero font to :after.

    #a {
      border: 1px solid black;
      text-align:justify;
      font-size:0;
      line-height:0;
    }
    #a:after {
      content:"";
      display:inline-block;
      width:100%;
    }
    
    #b, #c {
      display:inline-block;
    }
    
    #b {
      vertical-align:top;
    }
    #c {
      vertical-align:bottom;
    }
    

    font-size:0; looks not working in IE, so we need little workaround with 1px negative margin:

    /* ie fix */
    #a {
      font:1px/0 sans-serif;
    }
    #b, #c {
      margin:0 0 -1px;
    }
    

    Fiddle: http://jsfiddle.net/gv4qd/35/

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

Sidebar

Related Questions

I have the following HTML and CSS in a jsfiddle : <div class=MyBox> <div
My HTML: <table class=tab> <tr><td>aa</td><td>aa</td><td>aa</td></tr> <tr><td colspan=3><div class=in>bbb</div></td></tr> </table> <table class=tab> <tr><td>aa</td><td>aa</td><td>aa</td></tr> <tr><td colspan=3><div
Here's a puzzle. Basic page, one element: http://jsfiddle.net/PZj6t/ HTML: <div id=container></div>​ CSS: body, html
The html code is pasted into this url http://jsfiddle.net/nzYjV/ The div (id=input) contains the
Fiddle is here - http://jsfiddle.net/ashwyn/a45ha/ HTML here - <div class=parent> <div class=a>Class A</div> <div
Here is my fiddle: http://jsfiddle.net/jamesbrighton/wxWgG/4/ HTML: <div> <p class=click>Click 1</p> <p>This should be ignored</p>
Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
Only yesterday did I need to animate the border color of an HTML div
I have a simple HTML structure ( jsfiddle ): <li> <div class=buttons> <a href=done><img
Here is the fiddle: http://jsfiddle.net/hrQG6/ HTML <div id='map'> <div class='hotspot' id='hs1'> <div class='info-window'> Foobar

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.