Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> span { color: green; font-size: 2vh; } p { color: red; font-size: 1em; } .length { color: orange; font-size: 30px; } h3 { color: lightblue; font-size: 3ex; } h1 { color: purple; font-size: 24pt; } a { color: blue; font-size: 120%; } </style> </head> <body> <h2>Font-size property</h2> <span>This text is written with 2vh font-size.</span> <p>This paragraph is written with 1em font-size.</p> <div class="length">Example with 30px font-size length </div> <h3>Example with 3ex font-size length.</h3> <h1>We set the font size 24pt for this heading.</h1> <a href="https://www.w3docs.com/">This hyperlink is written with 100% font-size.</a> </body> </html>