Last Updated on April 26, 2023 by Roshan Parihar
HTML style tag is used inside html webpages to include the inline css. The inline css gives styling to the content of the website. The look and feel depends upon the CSS.
Syntax of HTML style tag
1 2 3 |
<style> Enter some style here using tag classes and ids </style> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<!DOCTYPE html> <html> <head> <title>Style tag example</title> <style> p{ color: #ccc; } </style> </head> <body> <p>This is example using inline style to show the output of CSS.</p> </body> </html> |
Output
This is example using inline style to show the output of CSS.
We can style the HTML element without using <style> tag. Instead of using this tag, we can use style attribute to give CSS.
1 |
<p style="color: green;">This is example using inline style without using the style tag.</p> |
Output
This is example using inline style without using the style tag.
Resources and References
1. W3C Specification.
2. HTML living standard
3. W3C project using Github