
The HTML <style> element defines style information (CSS) for a document.
Inside the <style> tag you can define how HTML elements should render in a browser.
Example:
<!DOCTYPE html>
<html>
<head>
<style>
h4 {color:#2a9d8f;}
p {color:#e76f51;}
</style>
</head>
<body>
<h4>This is a heading</h4>
<p>This is a paragraph.</p>
</body>
</html>
Output:
This is a heading
This is a paragraph.
Note: To connect to an external style sheet, use the HTML <link> element.
Attributes:
media (value- media_query) – defines what media/device the media resource is optimized for.
Syntax:
<style media="value">
type (value- text/css) – defines the media type of the <style> element.
Syntax:
<style type="media_type">
To learn more about HTML <style> element go to the CSS tutorials.
Enjoy coding!