Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS vw and percentage value convert to pixel value

Tags:

less

How do we know that how many pixels in width:100% and width:100vw ?

Situation

body{
 width:100%;
}
.container{
  width:1000px;
}

How do i get exact value ?

balanceWidth = bodywidth - containerwidth

I know about css calc width: calc(100% - 1000px); , I need to get exact pixel value

like image 239
ShibinRagh Avatar asked Jan 22 '26 00:01

ShibinRagh


1 Answers

For this:

balanceWidth = bodywidth - containerwidth

You can use calc method:

width: calc(100% - 1000px);

When you have 1000px wide element you assume the percentage wide is 100% and for 1% you can calculate taking 1000px dividing by 100.

like image 76
Bhojendra Rauniyar Avatar answered Jan 23 '26 21:01

Bhojendra Rauniyar