3

This is what i am trying to do;

scheme

Is this even possible?

7
  • 1
    caniuse.com/#search=flexbox Commented Jul 14, 2013 at 13:00
  • Divs take all available horizontal space already on default. (Unless it is floating) Commented Jul 14, 2013 at 13:01
  • @KhawerZeshan — No. 100% would include the space already taken up by the section marked "fixed width". Commented Jul 14, 2013 at 13:01
  • @Cthulhu — Presumably it is floating (or has some other properties applied to stop it taking up the whole width) since it is next to another element Commented Jul 14, 2013 at 13:02
  • @Quentin Flex is not well supported, especially IE will spoil the game, than you need to have 10 kinds of polyfills and stuff... Commented Jul 14, 2013 at 13:06

1 Answer 1

2

Do you mean something like this?

Demo

.wrap {
    height: 400px;
    border: 1px solid red;
}

.left {
    height: 400px;
    width: 120px;
    float: left;
    border: 1px solid green;
}

.max {
    height: 400px;
    margin-left: 130px;
    border:1px solid red;
}

Explanation: float: left; your first div and move other element to the right using margin-left: fixed-div-width + some extra space and than encapsulate both elements in a wrapper. Just a side note, don't forget to clear your floating elements

Sign up to request clarification or add additional context in comments.

4 Comments

It's a bit dirty but it's required for cross-browser support, so i will use it. Thanks.
@m_poorUser nothing dirty here, this is the only way if you are ignoring the flex box, else you need to use scripts :)
I said dirty because you need to change .max's margin-left if you change width of .left. But hey, i've done worse things for compatibility :)
@m_poorUser haha yes, we are web dev.. so till we don't have a specific set of rules to follow and till browsers keep ignoring the wrong approaches, dirty will stay... always..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.