Set font-size relative to page size for responsive layout - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Set font-size relative to page size for responsive layout

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
h1 {<!-- w ww . j  a  va 2  s . c o m-->
   font-size:23px;
   color:Chartreuse;
}

@media only screen and (max-width: 900px)  {
   h1 {
      font-size:21px;
      color:yellow;
   }

}

@media only screen and (max-width: 800px)  {
   h1 {
      font-size:19px;
      color:blue;
   }

}

@media only screen and (max-width: 700px)  {
   h1 {
      font-size:13px;
      color:pink;
   }

}
</style> 
 </head> 
 <body> 
  <h1>Lorem ipsum dolor sit</h1>  
 </body>
</html>

Related Tutorials