HTML CSS examples for CSS Layout:Responsive Layout
Responsive and perfect square div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .field {<!--from w w w . j av a2 s. c om--> background:Chartreuse; border:2.26vh solid yellow; } .field .player { width:6vh; height:6vh; background:blue; } @media only screen and (orientation: portrait) { .field { width:76vw; height:76vw; } } @media only screen and (orientation: landscape) { .field { width:76vh; height:76vh; } } </style> </head> <body> <div class="field"> <div class="player"> </div> </div> </body> </html>