<html> <body> <div class="test"></div> </body> </html>
By default 1rem = 16px; font-size: 62.5%, 1rem = 10px; font-size percentage of the following settings according to the screen resolution, the aspect ratio can guarantee div consistent at different resolution, page size font to use rem Similarly
/ * The screen resolution adaptive Size * / @media (max-width: 1921px) { HTML { font-size : ! 62.5% Important ; / * 1 rem = 10px * / } } @media (max-width: 1601px) { HTML { font-size : 52.08333333% Important! ; } } @media (max-width: 1367px) { HTML { font-size : 44.46614583% Important! ; } } @media (max-width: 1281px) { HTML { font -size : ! 41.66666666% Important ; / ** / } }
.test{
width:20%;
height:5rem;
}