HTML Style <style>

Usage

The style tag defines styling at an individual page level.

While this made sense in the early days when a page had very simple styling, in current day you would probably have a CSS stylesheet which you would ‘call in’ to this document, as seen on the Link Tag page.

Code:


<!DOCTYPE html>

<html>

<head

<style type="text/css">
p {color: green}
h1 {font-size: 1em}
</style>

</head

<body>

Content of the page goes here.

</body>

</html>

Required Attributes

  • None

Optional Attributes

  • Type: You can define the style type which is usually ‘text/css’, however this attribute was once required and now defaults to ‘text/css’ if not defined
  • Media: You can define what media type will display this style

Core Attributes