|
Free
computer Tutorials
|
![]() |
HOME
|
Stay at Home and Learn | |||||
|
Web Design Tutorials |
||||||
|
Design a Web Page with an Image
In this lesson, we're going to design a web page with an image. Before you make a start, download the images in the link below: Click here to download the Images for this lesson Once you've downloaded the images, try the following.
Copy the planet images (NOT the folder) you downloaded above to the same place where you saved your web page. To insert an image, do the following:
You will be taken back to the Insert Image dialogue box. Notice the text box at the bottom: "Use this text if image doesn't appear". Sometimes, things go wrong with web pages, and the browser cannot find the image. In that case, you can type some alternative text which will display if the image is not found.
<HTML>
<HEAD> <TITLE>Insert Your Title Here</TITLE> </HEAD> <BODY BGCOLOR = White> This image was created using Paint Shop Pro 7 <IMG SRC = "planet2.jpg" ALT = "Planet Image"> </BODY>
What happened? You probably found that the image displayed on the right hand side, and the text on the left hand side, near the bottom of the image. But if you look at the code, you'll see we typed the text first, then put the Image code on the line below it. So why didn't the image appear underneath the text? The image appears to the right of the text because of one reason: HTML code does not recognise the carriage return. So when you press the enter key on your keyboard to get a new line, the HTML Editor itself knows what you mean, and what you want. But when you load the code into a browser, that new line break is not recognised. The browser thinks you want the text and the image on the same line. With HTML code, you have to "tell" the browser that you want to start a new paragraph. If you forget, then the browser will put everything on the same line. The way you "tell" the browser to start a new line is with either the <P> tag or the <BR> tag. The P stands for Paragraph, and the BR for Break. The difference between the two is that the <P> tag gives you double space, and the <BR> tag gives you single space. To insert a Paragraph tag, click where you want the new paragraph to be. Then click Insert > Paragraph from the menu bar. Or click the <P> icon in the toolbar. To insert a Break tag, click where you want the new Break to be. Then
click Insert > Break from the menu bar. Or click the <BR>
icon in the toolbar. After you have inserted a <BR> or <P> tag, save your work, and then view the web page. You should see the image appear below the text. To see the ALT part of the image code in action, delete a couple of letters from the file name. Something like this: <IMG SRC = "anet2.jpg" ALT = "Planet Image"> Save your work, and then view the web page again. You should have gotten something like this in the browser:
The red X signifies that an image could not be found. The ALT text we typed appears in its place. If you keep getting a red X instead of an image, make sure you image file referencing is correct (The SRC part of the IMG tag.)
In the next lesson, you'll learn all about image alignment.
<-- Back One Page Move on to the Next Part --> <--Back to the Web Design Contents Page View all our Home Study Computer Courses
|