HTML and CSS Reference
In-Depth Information
Q Is the
<p>
tag the general-purpose tag for use when styling a page?
A
No. The
<div>
tag is the general purpose tag for containing content on a page. The
<p>
tag is intended specifically to hold paragraphs of text. There are many tags that
are not valid when placed within a
<p>
tag, including
<div>
. You learn more about
<div>
in Lesson 7, “Formatting Text with HTML and CSS.”
Q Is it possible to put HTML tags inside comments?
A
Yes, you can enclose HTML tags within comments, and the browser will not dis-
play them. It's common to use comments to temporarily hide sections of a page,
especially when testing things. Programmers (and web developers) generally refer
to this as “commenting it out.”
Quiz
1.
What three HTML tags describe the overall structure of a web page, and what do
each of them define?
2.
Where does the
<title>
tag go, and what is it used for?
3.
How many different levels of headings does HTML support? What are their tags?
4.
Why is it a good idea to use two-sided paragraph tags, even though the closing tag
</p>
is optional in HTML?
4
Quiz Answers
1.
The
<html>
tag indicates that the file is in the HTML language. The
<head>
tag
specifies that the lines within the beginning and ending points of the tag are the
prologue to the rest of the file. The
<body>
tag encloses the remainder of your
HTML page (text, links, pictures, and so on).
2.
The
<title>
tag indicates the title of a web page in a browser's bookmarks, hotlist
program, or other programs that catalog web pages. This tag always goes inside the
<head>
tags.
3.
HTML supports six levels of headings. Their tags are
<h1 .. /h1>
through
<h6 .. /h6>
.
4.
The closing
</p>
tag becomes important when aligning text to the left, right, or
center of a page. (Text alignment is discussed in Lesson 7.) Closing tags also are
required for XHTML 1.0.