Answer the question
In order to leave comments, you need to log in
Why does margin-top depend on the element's width?
codepen
Why with values in class .range-slider_vertical {}
width: 300px;
height: 7px;
width: 7px;
height: 300px;
<div class="range-slider range-slider_vertical">
Answer the question
In order to leave comments, you need to log in
For margin, the percentage size is always calculated from the width of the parent block.
In CSS 2.1
<percentage>
The percentage is calculated with respect to the width of the generated box's containing block. Note that this is true for 'margin-top' and 'margin-bottom' as well. If the containing block's width depends on this element, then the resulting layout is undefined in CSS 2.1.
Percentages: refer to logical width of containing block
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question