![]() |
|
Editing an HTML Web PageWe learned a little about adding images to a web page using the Now we're going to learn how to place them in the paragraphs of our web pages. We'll also learn how to add some new attributes to the images. Open about.html in NotePad. Delete the paragraphs in the right column. You can type a couple paragraphs of new text or paste the paragraphs from the demo site: If we used the code we already know to add our new image, me.gif, it would look like this: When placing images on web pages you should always include the dimensions of the image. The dimensions are defined in width and height. This will make it easier and faster for the browser to display them. You can use the width and height attributes to actually resize and image on a page. This is a bad practice that most WYSIWYG editors employ. Size your image properly using a graphics optimizer and then define the image with its proper width and height settings. The me.gif that we are adding is 99 pixels wide and 152 pixels high. To be W3C compliant you should also provide an Alternate Text for your image. this text will appear if the image fails to load or if someone views the page with a browser that doesn't display pictures. The alt text would be just a brief description of the picture. Some SEO experts tell you to place keywords in your alt attributes. I leave the decision on that to you. Our Alternate Text will be A picture of me. When setting pictures in paragraphs, we must tell the browser how to align the image. Choices of alignment are left, right and center. Specify left to place the image to the left of your text. Specify right to place the image to the right of your text. The center value is used for small images like icons or thumbnails and will cause the image to display inline with your text like it was a word in your paragraph. Because we have the large strawberry image in the left column of our web page, our new image would probably look best if we align it to the right to balance the page. If you've added your new paragraphs, copy and paste the image code between the first paragraph tag and the first word of the sentence. ( about.html ) If you used the paragraphs from the demo your code will look like this: Save the changes
The new image is aligned to the right of the text. If you look close you'll notice that the text is right up against the image border. it would look better if there was a little space between the picture and the text. We can create that space by adding a margin to the picture using our stylesheet. Since we don't want to affect the images in the left column we will specify the right column for our image margin. Open the style sheet and paste this block of code: Now use the procedure we used to change the about.html page and see if you can make the changes to the friends page and set another image in the first paragraph. See if you can make the changes without looking at the code below.
Test your website and see if everything is working properly. If it is you are ready to move on to the next lesson on changing the appearance.
|
HTML Tutor HTML Editors Online Builder Tutorials Other Helps |
|
www.createasite.net ©2008 All Rights Reserved - Create a Site with HTML |