font width html code example

Example 1: how to change font size in html

<body>      
         <h1 style="color:red;font-size:40px;">Heading</h1>      
         <p style="color:blue;font-size:18px;">This is demo text</p>    
      </body>

Example 2: font-strech css

/* Keyword values */
font-stretch: ultra-condensed;
font-stretch: extra-condensed;
font-stretch: condensed;
font-stretch: semi-condensed;
font-stretch: normal;
font-stretch: semi-expanded;
font-stretch: expanded;
font-stretch: extra-expanded;
font-stretch: ultra-expanded;

/* Percentage values */
font-stretch: 50%;
font-stretch: 100%;
font-stretch: 200%;

/* Global values */
font-stretch: inherit;
font-stretch: initial;
font-stretch: unset;

Example 3: html font size

<h1 style="font-size:10vw">Hello World</h1>

Example 4: how to stretch text in javascript

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      span.stretch {
        display: inline-block;
        margin: 35px;
        -webkit-transform: scale(2, 1);
        -moz-transform: scale(2, 1);
        -o-transform: scale(2, 1);
        transform: scale(2, 1);
      }
    </style>
  </head>
  <body>
    <p>This text is
      <span class="stretch">stretching</span>.
    </p>
  </body>
</html>

Tags:

Html Example