HTML CSS examples for CSS Layout:Responsive Media
define height responsiveness using media query in CSS
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> html, body { background:Chartreuse; padding:0px; margin:0px; color:yellow; height:100%; width:100%; display:table; } .wrapper {<!-- ww w . j a v a 2 s.co m--> margin:0 auto; position:relative; width:100%; display:table-cell; vertical-align:middle; } .main { -moz-border-radius:7px / 7px; -webkit-border-radius:7px 7px; border-radius:7px / 7px; padding:21px; background:blue; width:301px; margin:auto; transition:0.4s; } @media screen and (max-height: 400px) { body { background:pink; } .main { -ms-transform:scale(0.8, 0.8); -webkit-transform:scale(0.8, 0.8); transform:scale(0.8, 0.8); } } @media screen and (min-height: 500px) { body { background:OrangeRed; } .main { -ms-transform:scale(2.4, 2.4); -webkit-transform:scale(2.4, 2.4); transform:scale(2.4, 2.4); } } </style> </head> <body> <div class="wrapper"> <div class="main"> <h2>Lorem ipsum dolor sit </h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed qu</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed qu</p> </div> </div> </body> </html>