If you want to scale the content in a specific height you can use transform: scale();
and media queries with max-height:
First the HTML
<div class="wrapper">
<div class="main">
<h2>Hi my name is Shashank</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis, fugiat, aut, repellendus architecto repellat at soluta perspiciatis suscipit quia error tempora ea aliquid saepe beatae id excepturi cupiditate esse ex.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis, fugiat, aut, repellendus architecto repellat at soluta perspiciatis suscipit quia error tempora ea aliquid saepe beatae id excepturi cupiditate esse ex.</p>
</div>
</div>
Then the CSS
html, body {
background: #333;
padding: 0px;
margin: 0px;
color: #222222;
height: 100%;
width:100%;
display: table;
}
.wrapper {
margin: 0 auto;
position: relative;
width: 100%;
display: table-cell;
vertical-align: middle;
}
.main {
-moz-border-radius: 6px / 6px;
-webkit-border-radius: 6px 6px;
border-radius: 6px / 6px;
padding: 20px;
background: #4694e8;
width:300px;
margin: auto;
transition: 0.3s;
}
/* When height is 400 or less scale the content to 0.7 */
@media screen and (max-height: 400px) {
body {
background: #444;
}
.main {
-ms-transform: scale(0.7, 0.7);
-webkit-transform: scale(0.7, 0.7);
transform: scale(0.7, 0.7);
}
}
/* When height is 500 or more scale the content to 1.3 */
@media screen and (min-height: 500px) {
body {
background: #222222;
}
.main {
-ms-transform: scale(1.3, 1.3);
-webkit-transform: scale(1.3, 1.3);
transform: scale(1.3, 1.3);
}
}
I recomend also center the content with display:table
in html and body tags and display: table-cell
with vertical-align: middle
in the wrapper div
Here is a demo: https://jsfiddle.net/da2ds0nj/2/
I hope this help you, and excuse me by my english.