Skip to content
Related Articles

Related Articles

HTML | <style> type Attribute

View Discussion
Improve Article
Save Article
  • Last Updated : 27 Jul, 2022
View Discussion
Improve Article
Save Article

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 default value is “text/css” indicates that the content is CSS. 

Syntax:

<style type="media_type">

Note: This attribute is depreciated from HTML 5.

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. 

html




<!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 Type Attribute</h2>
    <p>It is a Computer science portal for Geeks.</p>
 
</body>
 
</html>

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
Recommended Articles
Page :

Start Your Coding Journey Now!