font size css 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 size css

.class {
	font-size: 12px;
}

Example 3: html font size

<span style="font-size:20px;"></span>

Example 4: text size in CSS

font-size: 2em;

Example 5: font size css

/* you can set the font size using font-size: and a number followed by px */

.class {
  font-size: 60px;
}

Example 6: font size css

/* <absolute-size> values */
font-size: xx-small;
font-size: x-small;
font-size: small;
font-size: medium;
font-size: large;
font-size: x-large;
font-size: xx-large;
font-size: xxx-large;

/* <relative-size> values */
font-size: smaller;
font-size: larger;

/* <length> values */
font-size: 12px;
font-size: 0.8em;

/* <percentage> values */
font-size: 80%;

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

Tags: