Image Basics
Before jumping into the finer points of the
<img> tag, let’s back up and consider
general graphics usage issues.
Inline Graphic Uses
Graphic files can be used in a number of ways on the Web. Images may
be used as background tiles (added with the
background attribute in the
<body> tag as noted in Chapter 9). You can also create a link to a graphic file
that displays either in the browser window or in a helper application
if it is in a format that cannot be displayed by the browser.
This
chapter focuses on inline images, graphics that are displayed in the
browser window as part of the flow of the contents of the document.
Inline images are placed on the page with the
<img> tag. The overwhelming majority of
graphics on the Web are used as inline images, including banners,
buttons, logos, and so on. Graphics can serve a variety of functions:
- As a simple graphic
A graphic can be used on a web page much as it is used in print—as a static image that adds decoration or information, such as a company logo or an illustration.
- As a link
A graphic can also be used to link to another document as an alternative to text links. Linked graphics are discussed later in this chapter.
- As an imagemap
An imagemap is a single graphic with multiple “hotspots” that link to other documents. There is nothing special about the graphic itself; it is an ordinary inline image. Special coding and map files link pointer coordinates with their respective URLs. The
usemaporismapattribute within ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access