HTML and CSS Reference
In-Depth Information
14.5 Types of Style Sheets
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-
2. Inline —The style is defined for a specific HTML element.
3. External —The style is defined in an external file.
14.5.1 The Embedded Style Sheet and the <style> Tag
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>
h1 { color: blue ; }
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.
<style type="style sheet language">
<style type="text/css">
Search WWH ::

Custom Search