Book Image

Practical Web Development

By : Paul Wellens
Book Image

Practical Web Development

By: Paul Wellens

Overview of this book

Table of Contents (23 chapters)
Practical Web Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
10
XML and JSON
Index

Images


It is hard to imagine a website without images. Most people assume that adding a picture to a site is easy, that it may take a little bit of Photoshopping and that's it. This is actually not true, but it is all manageable. Being a photographer myself, I was disappointed to discover on my first time experimenting with HTML that putting text right next to a picture on a web page was painful. That was because I did not know enough CSS at the time.

There is actually only one HTML element needed to deal with images: the <img> tag.

<img> element and attributes

A typical piece of HTML containing an image would be:

<img  src="images/lupine.jog" alt="lupine" />

An img tag will never have any content inside so we always use the shorthand notation. The two attributes that are always present are src and alt. The value of the alt attribute is a text that will be displayed when the image file cannot be found or when device is used that cannot display images. The src attribute contains...