Answer the question
In order to leave comments, you need to log in
How to define the width or height of an element in css?
Hello! How to get the width of an element in css.
For example, I need to calculate the margin from the top: .element{margin-top: calc(50vh-n)}
where n is the height of the element. How is it labeled
Answer the question
In order to leave comments, you need to log in
vh-vw are just units.
.element{
margin-top: calc(50vh-n) // n - тут не прокатит, это переменная, её нельзя пропихнуть в css
}
this is css, you can’t really code in it, there are no variables here if you don’t use preprocessors. var h = $('#container').css('height');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question