HTML and CSS Reference
Before we get going on dealing with text on a Web page, we need to consider the fundamental
elements of a Web page. h ey include three types of actions:
Loading and displaying graphics
Linking to other pages
To display text, all you need to do is type it on the page in the <body> container. You can
style it with the <h> tag as you know from previous chapters, but basic text requires only that
it be in the body of a page.
Loading and displaying graphics uses the <img> tag with the following format:
< img src = ”imageName.png” >
You can use only .jpg , .png , or .gif i les with the img element. h e src attribute refers to
the source of the graphic. h e img element has other attributes, but all you need to get an
image on the page is the src attribute so that the i le can be located.
h roughout the topic, the term URL is ot en used to refer to a i le's location — no matter what
type of i le is involved. URL stands for Uniform Resource Locator and refers to a standard
protocol for i nding and using dif erent types of i les.
Finally, a link to another page uses the following format:
< a href = ”anotherPage.html” > Link abel </ a >
h e href refers to the linked page's hypertext reference, or more simply put, its address. Like
an image's source locations, you'll see the term url used for a linked page's address as well.
One more thing you need to know before continuing. h e document type declaration
( <!DOCTYPE HTML> ) in the very i rst line is important — don't ever leave it out. However,
an equally important line is declaring the character encoding. h is is used to tell the Web
browser which character set of letters to use, such as the A to Z alphabet, Hebrew characters,
Japanese, Cryllic, or some other set. You can do it in several ways, but this topic uses the
< meta http - equiv = ”Content-Type” content = ”text/html; charset=UTF-8” >
You always should specify character encoding. Although using the <meta> tag is a bit long,
you can just cut and paste it in all your Web pages. If you don't, you can run into security
vulnerabilities, and nobody wants that.