![]() | ![]() ![]() ![]() ![]() |
|
![]() |
GraphicsBesides hyperlinks, the other great advantage of the Web is the ability to integrate graphic images into a document. Some would argue that this represents one of the greatest strengths of the Web. Graphics are certainly used as heavily as hyperlinks, and represent most of the data which is transferred, so it's fitting that we spend some time discussing them. Again throughout this lesson, students are required to practise the new tags in their own documents. You will be asked to e-mail the files as attachments in the training report sheet below. If you are unable to make your own .gif or .jpeg files it is possible to take any image off the Web. Visit a site that has graphics you would like to use. To save an image you must click down on the image keeping the mouse button down (for PC users you must use the right hand button), you will be presented with a pull down menu. Select the save image as option and then follow the instructions to download the file. Make sure that the file is in a directory that you can direct your html links at easily. We would recomend placing all your html and image files together for the purposes of these exercises. IMG Tag
In order to make the IMG tag work, you need to use an SRC attribute. SRC stands for "source," as in, "the source of this graphic." (One way to read a typical image tag is "image source equals..." You'll see what I mean in a minute.) The value of SRC is the URL of the graphic you want to have displayed on your Web page. Thus, a typical image tag will take the form:
In relation to the text, the browser puts a graphic wherever an image tag occurs in the document. It will do this as though the graphic were just another piece of the text (which, in a certain way, it is). For example, if you put an image tag between two sentences, the browser would show the first sentence, then the graphic, and then the second sentence right after the graphic. Thus...
<IMG SRC="vroom3.gif"><BR> Its great is'nt it?
![]() Its great is'nt it?
Placing images within links is also possible. To do so, merely place the IMG tag within the anchor container. For example:
<IMG SRC="generic-image.gif"> </A>
<A HREF="tcopy.htm"> The above markup would then appear as:
As you can see, if you do include text within the anchor container, then it will be a part of the anchor along with the image. There are two other attributes to the IMG tag which should be discussed. Both are less frequently used than SRC (because SRC is so essential) but each is important in its own way. ALT The ALT attribute is used to define "alternate text" for an image. The value of ALT is author-defined text, enclosed in double-quotes, and ALT text can be any amount of plain text, long or short. To pick one of an infinite number of examples, a warning symbol could be marked up as follows:
However, if ALT text has been defined, the browser will display that text instead of the placeholder. This makes the display a lot nicer and more useful for users who can't or don't want to see the graphics, and doesn't affect users who can see graphics at all. A common trick to make image placeholder disappear in text-only browsers is to set the ALT text to be a single space:
ALIGN As was pointed out in Example 1, a lot of vertical space can be wasted when graphics are integrated into paragraphs. This is because ordinary HTML 2.0 does not support anything which allows for multiple lines of text flowing past a graphic. However, the text can be shifted within the vertical space which is created by the graphic. In addition to having the text lined up with the bottom of the graphic, you can align it to either the top or the middle of the graphic. This is accomplished using the ALIGN attribute, as in the following:
This will cause the top of any text on the same line as that graphic to be aligned with the top of the graphic. There is also an ALIGN=middle option, which will align the text's baseline with the middle of the graphic, and of course ALIGN=bottom, which is the default display strategy for most browsers. Try it out for yourselves. Getting the Right Format The "universal" standard (at least for the near future) is the GIF file format. GIF stands for Graphic Interchange Format, and all graphical browsers use that format for in-lined images. While this may change to some degree in the future, for now, my advice is to use GIF files in order to ensure maximum cross-browser compatibility. The other main graphical file format that is used is JPG. This is equally compatable across browsers.
training report sheet Please use the above material to answer the following questions:-
|
|
![]() |
||
![]() | ![]() ![]() ![]() ![]() |
|