04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

eview using images <strong>with</strong> html<br />

214 Chapter 5<br />

BULLET POINTS<br />

n Use the element to place images in<br />

your Web page.<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

Browsers treat elements a little<br />

differently than other <strong>HTML</strong> elements; after<br />

reading the <strong>HTML</strong> page, the browser retrieves<br />

each image from the Web server and displays<br />

it.<br />

If you have more than a couple of large<br />

images on a Web page, you can make<br />

your Web page more usable and faster to<br />

download by creating thumbnails – small<br />

images that the user can click on to see the<br />

large version of the image.<br />

The element is an inline element,<br />

which means that the browser doesn’t put a<br />

linebreak before or after an image.<br />

The src attribute is how you specify the<br />

location of the image file. You can include<br />

images from your own site using a relative<br />

path in the src attribute, or images from other<br />

sites using a URL.<br />

The alt attribute of an element is a<br />

meaningful description of the image. It is<br />

displayed in some browsers if the image can’t<br />

be located, and is used by screen readers to<br />

describe the image for the visually impaired.<br />

A width of less than 800 pixels is a good<br />

rule of thumb for the size of photo images<br />

in a Web page. Most photo images that are<br />

created by digital cameras are too large for<br />

Web pages, so you’ll need to resize them.<br />

Photoshop Elements is one of many photo<br />

editing applications you can use to resize your<br />

images.<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

n<br />

Images that are too large for the browser<br />

make Web pages difficult to use and slow to<br />

download and display.<br />

A pixel is the smallest dot that can be<br />

represented on the screen. Each image is<br />

composed of thousands of pixels. Depending<br />

on your monitor, there can be anywhere from<br />

72 pixels in an inch to 120 pixels in an inch.<br />

JPEG and GIF are the two formats for images<br />

that are widely supported by Web browsers.<br />

The JPEG format is best for photographs and<br />

other complex images.<br />

The GIF format is best for logos and other<br />

simple graphics <strong>with</strong> solid colors, lines, or text.<br />

JPEG images can be compressed at a variety<br />

of different qualities, so you can choose the<br />

best balance of quality and file size for your<br />

needs.<br />

The GIF image format allows you to make an<br />

image <strong>with</strong> a transparent background. If you<br />

put an image <strong>with</strong> a transparent background<br />

in a Web page, what’s behind the image, such<br />

as the background color of the page, will show<br />

through the transparent parts of the image.<br />

In Photoshop Elements, use the Matte color<br />

menu in the “Save for Web” dialog to choose<br />

the right color for softening the edges of your<br />

transparent GIF image.<br />

Images can be used as links to other Web<br />

pages. To create a link from an image, use<br />

the element as the content of an <br />

element, and put the link in the href attribute<br />

of the element.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!