Chapter 3: Text Tags and a Little CSS3

A Web page is unlike the kind of page you put in your word processor and start typing. Web pages are designed for computer screens of some sort — whether it’s a big desktop, a laptop, or even a mobile device. You’re not dealing with an 81⁄2-by-11-inch sheet of paper — you’re dealing with a far more dynamic viewing platform. So, the first thing you want to think about is how your page is going to look on a digital screen.

The Fundamentals

Before we get going on dealing with text on a Web page, we need to consider the fundamental elements of a Web page. They include three types of actions:

• Displaying text

• 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 files with the img element. The src attribute refers to the source of the graphic. The img element has other attributes, but all you need to get an image on the page is the src attribute so that the file can be located.

Throughout the book, the term URL is often used to refer to a file’s location — no matter what type of file is involved. URL stands for Uniform Resource Locator and refers to a standard protocol for finding and ...

Get Smashing Html5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.