Learn html - html tutorial - style tag in html - html examples - html programs
- The <style> tag is holds style information for a HTML document or part of a document.
- In HTML, each document can contain multiple <style> tags.
- The <style> tag supports Global Attributes and Event Attributes.
- <style> element belongs to Metadata content, and if the scoped attribute is present flow content.
Syntax for <style> tag:
Difference between HTML 4.01 and HTML 5 for <style> tag:
HTML 4.0.1
- HTML 4 is does not support “scoped” attributes of <style> tag.
HTML 5
- HTML 5 is support “scoped” attribute of <style> tag.
Sample Coding for <style> tag:
Code Explanation for <style> tag:
- <style> tag is used to set color for a <h1> tag and set the font-size and color for a <p> tag.
Output for <style> tag:
- The <h1> tag “Welcome to Wikitechy” content will be displayed in blue color, which is specified in <style> tag.
- The <p> tag “This is a paragraph with style.” content will be displayed in red color and font-size as 38pt, which is specified in <style> tag.
Attributes of <style> tag:
Attribute |
Value |
HTML4 |
HTML5 |
Description |
media |
media_query |
Yes |
Yes |
The attribute define which media the CSS style should apply to. |
scoped |
scoped |
No |
Yes |
This attribute is used to define the style only to this element’s parent element and that element’s child element. |
type |
text/css |
Yes |
No |
This attribute is used to define the media type of the <style> tag. |
Browser Support for <style> tag in HTML:
Tips and Notes
- Use the <link> tag to link an external style sheet.
- Each <style> tag must be located in the head section, if the “scoped” attribute is not used.
Related Searches to style tag in html
html css class
html style tag in body
style html
base href angular
html style attribute
html inline style
html font family
style type= text/css
html tutorialshtml editor html code html form html tutorial html color html color codes html table html img html5 html code for website html and css html programs html website free html editor html5 tutorial wysiwyg html editor html tutorial pdf html converter php tutorial html example html tutorial css tutorial html css html tags html basics code html html online html mailto html lang html tags list