HTML and CSS Reference
In-Depth Information
Webville Guide to HTML, continued
In this handy guide, we've boiled down writing well-formed HTML pages
into a common sense set of guidelines. Check them out:
What's a
<head>
without a
<title>
?
Always give your
<head>
element a
<title>
element. It's the law. Failure to do so will result in
HTML that isn't compliant. The
<head>
element
is the only place you should put your
<title>
,
<meta>
, and
<style>
elements.
Be careful about nesting certain elements.
Within the guidelines we've provided here, the
nesting rules are fairly flexible. But there are a couple
of cases that don't make sense. Never nest an
<a>
element inside another
<a>
element because that
would be too confusing for our visitors. Also, void
elements like
<img>
provide no way to nest other
inline elements within them.
Check your attributes!
Some element attributes are required, and some are
optional. For instance, the
<img>
element wouldn't
make much sense without a src attribute, and now
you know the alt attribute is required too. Get familiar
with the required and optional attributes of each
element as you learn it.