HTML and CSS Reference
In-Depth Information
There are several ways to define style sheets within a document:
1.
Embedded
—The style is defined within the
<style>
tags for the HTML docu-
ment.
2.
Inline
—The style is defined for a specific HTML element.
3.
External
—The style is defined in an external file.
A style sheet that is created with the HTML
<style></style>
tags right in the current doc-
ument is called an embedded style sheet.
The
<style>
Tag.
The
<style></style>
tags were introduced into HTML to allow the
style sheets to be inserted right into an HTML document. They are used to create a set
of rules to define the style of an HTML element(s). The
<style></style>
tags are placed
between the
<head></head>
tags in the document, as shown here:
<html><title>CSS Example</title>
<head>
<style>
h1 { color: blue ; }
</style>
</head>
The
type
Attribute.
Because it is possible to have more than one style sheet lan-
guage, you can tell the browser what type of style sheet you are using with the
type
attri-
bute of the HTML
<style>
tag. When the browser loads the page, it will ignore the style
sheet if it doesn't recognize the language; otherwise it will read the style sheet.
The following example specifies that the type is
text/css
; that is, text and CSS.
FORMAT
<style type="style sheet language">
Example:
<style type="text/css">