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

Live Demo

<!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>
Updated on: 2020-06-30T07:48:43+05:30

309 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements