How to create responsive typography with CSS?

CSSWeb DevelopmentFront End Technology

To create responsive typography with CSS, the code is as follows −

Example

 Live Demo

<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<head>
<style>
   h1 {
      font-size: 10vw;
   }
   p {
      font-size: 5vw;
   }
</style>
</head>
<body>
<h1>Responsive Text Example</h1>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Earum, rerum.
</p>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Excepturi, necessitatibus officiis hic est in nobis!
</p>
</body>
</html>

Output

The following output will be produced by the above code −

On resizing the screen −

raja
Published on 07-May-2020 12:35:57
Advertisements