Open In App

HTML <style> type Attribute

Last Updated : 06 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax:

<style type="media_type">

Note: This attribute is depreciated from HTML 5.

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

HTML style type Attribute Examples

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

html




<!DOCTYPE html>
<html>
  
<head>
    <!-- HTML style type Attribute Example -->
    <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: In this example <style> element contains CSS rules for styling HTML elements. The type=”text/css”: Specifies CSS as the stylesheet language.

 

HTML-Style-type_attribute

HTML Style Type Attribute Example Output

Supported Browsers:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads