M
M
myaca2017-07-14 16:36:30
css
myaca, 2017-07-14 16:36:30

How to make a div take up the maximum available space?

Actually, a three-column layout, the left column has a fixed width, the middle one has a min-width, the rightmost one has a min-width && max-width.
Is it possible to make it so that if there is enough space, the right one takes its maximum value, and the middle one takes the rest of the place?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AlexKeller, 2017-07-14
@myaca

https://jsfiddle.net/7n2kxfwj/
If you make the text in the right column shorter, then it will take min-width. And with a long text there will be max-width
If you want the right one to occupy max with a short text, you can add flex to it: 1 1 auto;

T
tyzberd, 2017-07-14
@tyzberd

you can do this https://jsfiddle.net/tyzberd/9bpmr1v0/1/
or flex

R
Roman Alexandrovich, 2017-07-14
@RomReed

width:100%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question