html and images

Q. how do i put pictures on my page

you have to make sure that the picture is a .jpg or .gif
if the picture you want to use is a .bmp bitmap then you must use your graphics/paint program to save it as a .gif or .jpg, this is because .bmp file sizes are so large and therefore take much longer to download, .jpg and .gif file formats are generally a much smaller file size and .jpg files can be compressed to upto 72 dpi (dots per inch) and still be of an exceptable quality
photo quality images are usually saved as a .jpg and .gif files are more suitable for animations

to make the picture show up on your page use the image source tag
<img src="picture.gif">
the picture will default to the left of your page if you want to center it use the align attribute
<img align="center" src="picture.gif">
you can also use
align="left" or align="right"

use height and width attributes

pages will load faster if you tell the browser the size dimensions
have you ever seen those pages where the content of the document jump around? the reason that happens is that the users browser is trying to draw the page without knowing the size of the image, once the image has loaded, the computer redraws the page and everything is seen to jump and this repeats again and again until the page has fully loaded

<img height="90" width="120" picture.gif">


you can play around with the height and width attributes

<img height="100" width="300" picture.gif">


<img height="100" width="100" picture.gif">


use alt text

add the alt attribute so that when a user hovers their cursor over an image an alternative text message pops up <img "picture.gif" alt="picture of a bridge" >
try it picture of a bridge

how do i use a picture as a link

make sure you read and understood the page about links, its just a combination of what has already been talked about on this page, we just wrap the hyper reference around the image tag like so..
<a href="index.html"><img src="picture.gif"></a>
Try it html tutorial home

image problems

usually the easiest way around image problems is to include the full url (absolute url) of the image
<img src="http://www.someserver.com/username/picture.gif">

probably the most common problem with images is case sensetivity
THIS IS UPPER CASE
this is lower case
MiXInG cAse caUSEs prObLEms - especially on unix systems
so make it a habit to use lower case and avoid the temptation of begining each filename with capitals

« back | html tutorial | next »

//if the user is using IE 4+ if (document.all) document.write('click here to bookmark this site!') else document.write('press Ctrl and D to bookmark this page')
home
html tutorial css tutorial javascript webmaster articles link exchange

html tutorial

make money
from your website