Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to define style information of a document using HTML5 ?

  • Last Updated : 30 Jun, 2020

In this Article, we define style information for a document by using the <style>
element in the document. It is used to change our text, viewed on the page. This change includes changing font-size, font-family, font-color, etc. Not only the texts but you can also change the style of a body or part of a page. Now let us look into various attributes of style and what else the tag supports.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<tagname style="property:value;">

Example 1: The following example demonstrates to define style information for a document using HTML5.




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to define style information
        for a document using HTML5?
    </title>
</head>
  
<body>
    <h1 style="font-family:commanders;">
        Hello GeeksforGeeks.
    </h1>
  
    <h2 style="font-family:Chaparral Pro Light;">
        Hello GeeksforGeeks.
    </h2>
  
    <h3 style="font-family:algerian;">
        Hello GeeksforGeeks.
    </h3>
  
    <p style="font-family:Castellar;">
        Hello GeeksforGeeks.
    </p>
</body>
  
</html>

Output:



Example 2:




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to define style information
        for a document using HTML5?
    </title>
</head>
  
<body style="background-color:#616A6B;">
  
    <h1 style="font-family:commanders; 
        background-color:yellow;">
        Hello GeeksforGeeks.
    </h1>
  
    <h2 style="font-family:algerian; 
        background-color:cyan;">
        Hello GeeksforGeeks.
    </h2>
  
    <p style="font-family:Castellar; 
        background-color:green;">
        Hello GeeksforGeeks.
    </p>
</body>
  
</html>

Output:

Supported Browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!