style element
Specifies style sheet rules for a document.
The style element allows authors to include CSS code into the HTML document.
The style tag should be placed in the head element.
If you want to see the HTML tags by categories, please visit this page.
This element requires a closing tag.
JavaScript page for this element: style. |
Possible members:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Example HTML code 1:
This example illustrates the use of the style element:
|
||||
<head> <style> #sampleID {color:red;} .sampleClass {color: green;} b {color: blue;} </style> </head> <body> <div id="sampleID">The color of this text is red.</div> <div class="sampleClass">The color of this text is green.</div> <b>The color of this text is blue.</b> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example shows how to import an external style sheet into the document. For detailed description, please see the @import at-rule.
|
|||||
<head> <style> @import "red.css"; </style> </head> <body> <div class="red">red division</div> <div>non-red division</div> <span class="red">red span</span> </body> |
|||||
|
|||||
Did you find this example helpful?
|
Related pages:
External links:
User Contributed Comments