HTML <style> type Attribute
Last Updated :
06 Mar, 2024
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 >
< 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 Example Output
Supported Browsers:
Share your thoughts in the comments
Please Login to comment...