Computer >> Computer tutorials >  >> Programming >> CSS

Set Responsive Font Size using CSS


To set the responsive font size, use the ‘viewport width’ and set it to ‘vw’ unit. You can try to run the following code to use ‘vw’ unit −

Example

<!DOCTYPE html>
<html>
   <head>
      <style>
         h1 {
            font-size:8vw;
         }
      </style>
   </head>
   <body>
      <h1>This is demo heading</h1>
      <p>This is demo text.</p>
   </body>
</html>