Page 119 - CA_165_V2.0_Flipbook
P. 119

HSPACE Attribute
                 This attribute is used to set the space towards left or right margin of the image. It indicates the given
                 space between the image and the text in numbers. Syntax to use the HSPACE attribute of the <IMG> tag
                 is as follows:

                   <IMG  HSPACE = "Value">
                 For example:
                   <IMG SRC = "C:\dolphin.JPG" HSPACE="2" BORDER="2">
                         Notes


                         The HSPACE attribute of <IMG> tag is not supported in HTML5.



                 VSPACE Attribute
                 This attribute is used to set the space towards the top or bottom margin of the image. It indicates the
                 given space between the image and the text in numbers. Syntax to use the VSPACE attribute of the
                 <IMG> tag is as follows:

                   <IMG  VSPACE = "Value">
                 For example:
                   <IMG VSPACE="2" BORDER="2" ALIGN="RIGHT" SRC="C:\dolphin.JPG">
                         Notes


                         The VSPACE attribute of <IMG> tag is not supported in HTML5.



                 ALT Attribute
                 The ALT attribute in HTML is used to specify alternative text for an image. This text is displayed if the
                 image cannot be loaded. A user can see the text which is enclosed within the ALT attribute. The text is
                 displayed whenever the mouse cursor moves over that area. Syntax to use the ALT attribute of the <IMG>
                 tag is as follows:

                   <IMG  SRC = "URL"  ALT = "Text">
                 For example:

                   <IMG  SRC= "C:\dolphin.JPG" ALT="My Picture">
                 The following HTML code uses the <IMG> tag to display an image of a dolphin with various attributes
                 such as SRC, HSPACE, VSPACE, ALT, BORDER, WIDTH, and HEIGHT:

                 <HTML>
                 <HEAD>
                 <TITLE>
                 WORKING WITH IMAGES

                 </TITLE>
                 <BODY BGCOLOR = "YELLOW">
                 A dolphin is a highly intelligent marine mammal known for its playful behavior
                 and social nature.

                                                                                            More About HTML      117
   114   115   116   117   118   119   120   121   122   123   124