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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:06:35+00:00 2026-05-25T14:06:35+00:00

Consider this bit of HTML & CSS: <html> <head> <title>Relative Positioning Resize Demo</title> <style>

  • 0

Consider this bit of HTML & CSS:

<html>
    <head>
        <title>Relative Positioning Resize Demo</title>
        <style>
            div.outerDiv {
                border: 1px solid black;
                height: 300px;
                padding: 10px;
            }

            div.innerDivA, div.innerDivB {
                border: 1px solid blue;
                float: left;
                width: 50%;
            }

            div.innerDivB {
                margin-left: 10px;
            }
        </style>
    </head>
    <body>
        <div class="outerDiv">
            <div class="innerDivA">content a</div>
            <div class="innerDivB">content b</div>
        </div>
    </body>
</html>

The outer div does not have a width specified and expands to the width of the browser window. I want the inner divs to behave similarly, expanding to the width available within their parent div while respecting the 10px margin and padding, never wrapping to two lines, and adjusting to the resizing of the browser window. I’ve tinkered with relative widths and haven’t really achieved the results I’m looking for.

Is this possible with CSS?

  • 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-25T14:06:35+00:00Added an answer on May 25, 2026 at 2:06 pm

    The desire for minimal markup is understandable, but mixing and matching percentages and specific pixel values with the various box models will not guarantee consistent results with how you have your present structure.

    You can do this one of several ways:

    1) Add more HTML markup; Fiddle to illustrate: http://jsfiddle.net/kgosser/d4Q2D/

    2) Be comfortable with the chance of layout breaking if page size dips below a certain width, such as 400px

    3) Do everything with percentages and be comfortable with the paddings being dynamic; Fiddle: http://jsfiddle.net/kgosser/EnSd2/

    4) Use jquery to dynamically adjust the widths, heights, and margins–specifically using absolute and relative positioning.

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

Sidebar

Related Questions

Consider the following HTML: <div id=myfavorites> <p><button id=saveFav>Save my favorites</button> </p> <p><a href=http://bit.ly/fzgxya>http://bit.ly/fzgxya</a> <a
Just to get it straight in my head. Consider this example bit of Erlang
Consider this bit of obfuscated code. The intention is to create a new object
Consider this (snipped) example <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> <html xmlns=http://www.w3.org/1999/xhtml>>
Greetings, This newbie needs clarification. Consider this bit of script... $(h3).click(function(){ $(this).addClass(silver); }); If
consider this example please int i=11, j=5; boolean b=true, c=false; System.out.println(b&c); // --> output=false
Consider this Example . The essential bit is the JavaScript: function encodeInput(editor) { theText
Consider the following HTML: <div class='x'> <ul> <li>Number one</li> <li>Number two</li> <li>Number three</li> <li>Number
Okay consider this bit of code: var d1 = new Date(); var d2 =
consider this piece of code: Welcome to Scala version 2.8.0.r0-b20100714201327 (Java HotSpot(TM) 64-Bit Server

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.