HTML and CSS Reference
In-Depth Information
Example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/
html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
Simple Style Element Example
</title>
<style type="text/css">
body {background: black; color: white;
font: 12px Helvetica;}
h1 {color: red; font: 14px Impact;}
</style>
</head>
<body>
<h1>
A 14-pixel red Impact heading on a black
background
</h1>
<p>
Regular body text, which is 12 pixel white Helvetica.
</p>
</body>
</html>
Compatibility
HTML 4, 4.01, 5
XHTML 1.0, 1.1
Firefox 1+, Internet Explorer 3+,
Netscape 4+, Opera 4+, Safari 1+
Notes
• Style information also can be specified in external style sheets as defined by a
<link>
tag.
• Style information can also be associated with a particular element using the
style
attribute.
• Style rules are often comment masked within a
<style>
tag to avoid interpretation
by nonconforming browsers.
<style type="text/css">
<!--
body {background-color: red;}
-->
</style>
• Internet Explorer's conditional comments also are useful to address browser
concerns. See the section “<!-- .[ ].. --> (Conditional Comment)” toward the start of
the reference.
• The meaning of some HTML5 global attributes like
accesskey
,
contextmenu
,
spellcheck
,
and
style
in particular are quite unclear for this element and may be
erroneous.
<sub> (Subscript)
This element renders its content as subscripted text.