Page 16 - Learn To Use HTML and CSS
P. 16
So You Want to Learn to Use HTML and CSS – Version 2020-06-12a Page 6
Chapter 1 — A Brief History and Creating Your First Page
What Makes up an HTML Document?
Free
HTML is a "plain-text" document made up of tags with content and attributes. This means that an
HTML document consists of human readable text that has minimal formatting mixed with tags
that tell the browser what the text means and suggests how to display the text. A tag is the
"Markup" in HTML and communicates to the web browser what the information means. For
example, the <p>...</p> tag tells the browser that the text and markup following it should be
eBook
treated as a paragraph.
HTML Tags
A tag is easy to recognize as it begins with a < and ends with a >. These tag opening symbols are
the "less-than" and "greater-than" symbols (also known as chevrons). If the tag contains content,
such as the text in a <p>...</p> tag, it will be followed by an end tag that is marked with a /.
Edition
For example, this is the proper way to mark up a paragraph:
<p>Example text.</p>
Some tags, also known as "empty tags" or "void tags", do not have an end tag. For example, the
Please support this work at
<hr> tag creates a Hard Rule (line) across the page. Since the <hr> tag does not contain
anything, it does not require an end tag.
http://syw2l.org
HTML Attributes
In a typical HTML document, tags need to be differentiated from each other and will need to
have special properties. We call those "attributes" of a tag. This is done by specifying the name
Free
of the attribute and then the value of that attribute in the opening tag. We should not need to
specify them again in the closing of the tag. For instance, the empty tag <img> which displays
images typically has two attributes:
<img src="picture.jpg" alt="a picture of me">
eBook
In this example, the attribute src (short for "source") defines the file name or URL of the image,
and alt (short for "alternate name") describes the image to users who cannot see the image. We
will learn, in a future chapter, how to use the <img> tag.
In order for CSS and JavaScript to easily find specific tags, the id and class attributes can be
Edition
added to any tag. An id is a unique identifier (ID) that may be assigned to one and only one tag
on a page. The class attribute may be shared between several tags, and a tag may belong to
multiple classes. The id or class name must begin with a letter and can then be made up of
Copyright 2020 — James M. Reneau PhD — http://www.syw2l.org — This work is
licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

