p tag
TAG: style
<style> ... </style>
The
style
tag is used to create document-level style sheet rules. It is referred to as document-level because the style rules will apply to the entire HTML page. In contrast, the
style
core attribute behaves as an inline style rule and only effects a small portion the HTML document.
The
style
tag must appear inside the
head
element. The code, contained between the opening and closing
style
tags, is not HTML, but is CSS (Cascading Style Sheets). For more information about Style Sheets, please visit the
CSS2 Quick Reference
.
The separate closing tag is mandatory.
Attributes and Events
dir
lang
title
media
The
media
attribute is a comma-separated list of one or more types of media in which the HTML document may appear (
all, aural, braille, handheld, print, projection, screen, tv,
and
tty
). The default is
screen
.
type
The mandatory
type
attribute is used to define the type of style being used. The most common value would be
text/css
. There is no default value.
Here is a simple example of creating document-level style rules. A series of CSS properties defining font face, color, and size is assigned to the
br, pre,
and
code
tags.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
<head>
<title>DevGuru XHTML style Tag Example</title>
<
style type="text/css"
>
<!--
q { font-face: arial; color: black; font-size: 18px }
pre { font-face: arial; color: red; font-size: 24px }
code { font-face: courier; color: blue; font-size: 36px }
-->
<
/style
>
</head>
<body>
<q>DevGuru is great!</q>
<p />
<pre>D e v G u r u i s g r e a t !</pre>
<p />
<code>DevGuru is great!</code>
</body>
</html>
Output:
Click to view results in separate window
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information