MMDT1021 Chapter 5 Notes - page 8
Inserting Images on a Page and Offering Alternate Text
Adding an image |
Code | Result |
---|---|
<img src="world.jpg" /> |
Adding alternative text |
Code | Result |
---|---|
<img src="world.jpg" alt="Second Image Text"
/> |
|
There is purposely an error in the file name to show you what happens when the image is not able to be displayed. You can see the alternate text being displayed.
|
Adding a border |
Code | Result |
---|---|
This effect using the border attribute has fallen out of favor as there are now better methods of accomplishing borders around images. However it is being show here for historical reasons.
|
|
The modern method is to use the style tag with border properties.
|
Specifying Size for Speedier Viewing
If you tell the browser how many pixels wide and high a picture is, the browser can then draw the page quicker. |
Code | Page |
---|---|
Here is a page without the use of width= and height= attributes. | Result Source |
Here is a page with the use of width= and height= attributes. | Result Source |