HTML | <style> type Attribute

The HTML <style> type Attribute is used to specify the MIME type of the <style> Tag. The attribute is used to identify the type of content contained by the <style> Tag.
For ex: The value “text/css” indicates that the content is CSS.

Syntax:

<style type="media_type">

Attribute Values: It contains the value i.e media_type which specify the Internet Media Type of the Stylesheet.



Example: This Example illustrates the use of type attribute in <style> Element.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <style type="text/css">
        h1 {
            color: green;
            font-size: 35px;
        }
          
        h2 {
            color: blue;
        }
          
        p {
            color: red;
        }
          
        body {
            text-align: center;
        }
    </style>
</head>
  
<body>
  
    <h1>GeeksForGeeks</h1>
    <h2>HTML Style Typr Attribute</h2>
    <p>It is a Computer science portal for Geeks.</p>
  
</body>
  
</html>

chevron_right


Output:

Supported Browsers: The browsers supported by HTML <style> type Attribute are listed below:

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


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.