Answer the question
In order to leave comments, you need to log in
How to set the width of a div equal to the size of the browser window minus a specific number of pixels?
codepen.io/anon/pen/RNaomd
We have a div with some width (100px) and a height of the entire window. The other div should take up all the remaining space, i.e. "browser_width - 100px".
I.e:
var page_w = $("html").width();
$(".main").css("width", page_w-100);
Answer the question
In order to leave comments, you need to log in
inscamp , not exactly as you wrote.
100% is from the size of the parent element.
If you need from the height/width of the screen, then special units of measure vw, vh, vmin, vmax appeared in css3 .
width: calc(100vw - 100px);
height: calc(100vh - 100px);
Solved the problem without resorting to scripts using the CSS3 calc() feature
.main {
width: calc(100% - 100px);
}
As far as I understand, we need the usual two-column layout .
JS and CS are definitely not needed here.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question