A
A
Anton Cauer2017-06-15 19:06:15
css
Anton Cauer, 2017-06-15 19:06:15

How to make empty blocks with height decreasing proportionally?

Let's say I have a main block in which there are other child blocks.
f8e612a159414fc1b7543447aa8f8645.png
Is it possible to make it so that when the main block is compressed, the dimensions of the height and width of the child block change, otherwise only the width changes, the height does not change. I type in flex.
Just can't figure out how to do this with empty blocks with no content and using jquery?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Ruslan Galiev, 2017-06-15
@antoncauer

Is this what you mean?

D
Dima Pautov, 2017-06-15
@bootd

CSS can't do this without scripting.
https://jsfiddle.net/opqtL30y/
There is a crutch option, put an image inside the block with a ratio of 1 to 1. And position the content on top.
This is shit, not a solution, because. gives rise to a lot of unpleasant surprises

N
name surname, 2017-06-15
@symbol

like so you can www.mademyday.de/css-height-equals-width-with-pure...

A
Anton Cauer, 2017-06-15
@antoncauer

I found another solution related to the size of the viewport, these are the sizes in vw and vh, I'll post them later.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question