How to reduce the height by 150 from the top and bottom?

120

Question: How to reduce the height by 150 from the top and bottom?

There is a fixed height, say 1000. If the screen height becomes less than 1000, then you need to remove 150 pixels from this height from the top and bottom. javascript error How can this even be done on pure js?

Total Answers: 1

24

Answers 1: of How to reduce the height by 150 from the top and bottom?

You can use css media queries for this.

for example lets say your code is

<div class='container'> <p> This is a paragraph </p> </div> 

css

.container{    margin-top:150px;    height:1000px    margin-bottom:150px; }   @media (max-height: 1000px) {      .container{         margin-top:0px;         height:1000px;         margin-bottom:0px;      }  } 

https://codepen.io/husnuljahneer/pen/poWQPgX