HTML and CSS Reference
In-Depth Information
(X)HTML Tags or Attributes
CSS Property Equivalent(s)
Notes
text-align
,
margin
Values for
margin
such as
auto
generally are used when
centering blocks with
text-
align
for content.
<center>
<font>
font-family
,
font-size
,
color
align
attributes
text-align
,
float
In the case of some elements
such as
<img>
, the CSS
float
property is more appropriate than
text-align
.
Color attributes for
<body>
color
,
background-color
To set some of the body
attributes like
link
,
vlink
,
alink
, pseudo-classes
:link
,
:visited
,
:active
should be
used for
<a>
tags.
Background image attributes
for
<body>
,
<table>
, and
<td>
background-image
The
type
and
start
attributes
on lists and list items
list-style-type
,
CSS counters
Single CSS properties can't
directly substitute some features.
The
clear
attribute for
<br>
clear
<s>
,
<strike>
text-decoration:
line-through
<u>
text-decoration:
underline;
<blink>
text-decoration:
blink
Not supported in all browsers.
T
ABLE
4-3
Common (X)HTML Structures Moved to CSS
The Specification of CSS
CSS 2.1 has a grammar (www.w3.org/TR/CSS21/grammar.html) but unlike traditional
(X)HTML it is not defined with a document type definition. Instead the CSS specification is
a combination of prose and a grammar that could be used to build a simple parser. For
example, when looking at the grammar for a set of style rules, we see
ruleset
: selector [ COMMA S* selector ]*
LBRACE S* declaration [ ';' S* declaration ]* '}' S*