Embedded styles

Embedded style allows to apply the same style settings to all elements of particular types in the entire HTML file. The embedded style can be specified in the header of an HTML document by using the following syntax:

<style type="style sheet language">
  style declarations
</style>

There are several style sheets languages, the most common and default one is "text/css". Note that type attribute is not required in HTML5 documents.

Style declarations within the <style> tag obey the following syntax:

selector {attribute1:value1; attribute2:value2; . . . }

where attribute1 is the name of a particular style attribute and value1 is the value the style applies to that attribute.

Example:

HTML tagsComments
<style type="text/css">
h3 { color:green; 
     font-family:sans-serif;
     font-size:28pt; 
     text-align:center }
</style>
. . . . . 
. . . . .
<h3>This is a styled H3 heading</h3>
<h3>This is another H3 heading</h3>
style declaration in the header
  text folor
  font family
  font size
  alignment
closing style declaration


usage of the above defined style
  in the body of HTML script

produces the following result

This is a styled H3 heading

This is another H3 heading