Page 99 - CodePilot V5.0 C7
P. 99

ATTRIBUTES OF THE <IMG> TAG
                 The following table summarises the attributes of the <IMG> tag:

                  Attribute Name           Value                                 Description

                  SRC                URL or file path    The SRC attribute  specifies  the  location  or URL  of
                                                         the image to be embedded.  You  can simply  write  the
                                                         name  of the file with its  extension  in the SRC value if
                                                         the image is saved in the same folder as the HTML file.
                                                         All <IMG> tags must include the SRC attribute.

                  ALT                Text description    It provides alternative text for the image, which describes
                                     of image            the image. If the image URL is incorrect or image is not
                                                         present in defined folder, the user will see the alternative
                                                         text in place of the image.

                 Syntax:

                 <IMG SRC="Name or path of the image file" ALT="TEXT">
                 If  the image file is in the same  folder, mention the name of the image  with its  extension.

                 For example:

                 <IMG SRC="beautiful-flamingos-lake.jpg" ALT="Flamingo Image">
                 If the image file beautiful-flamingos-lake.jpg is in a different folder than the HTML file, you need
                 to mention the complete path of the image file.

                 <IMG SRC="D:\beautiful-flamingos-lake.jpg" ALT="Flamingo Image">

                    Code     Write the HTML code to present the given web page using the <IMG> tag to display
                      5      an image.

                 <!DOCTYPE HTML>

                 <HTML>

                 <HEAD>
                 <TITLE>Flamingo Facts</TITLE>

                 </HEAD>

                 <BODY STYLE="BACKGROUND-COLOR: #F0F8FF;">
                 <H1 STYLE="COLOR: #FF6347;

                 TEXT-ALIGN: CENTER;"> All About Flamingos</H1>

                 <H2 STYLE="COLOR: #4682B4;

                 TEXT-ALIGN: CENTER;">The Graceful Pink Birds</H2>
                 <IMG SRC="beautiful-flamingos-lake.jpg" ALT="Flamingo Image">

                 <P STYLE="COLOR: #2F4F4F; TEXT-ALIGN: CENTER;">



                                                                                                                  97
                                                                                           Making Web Pages Alive
   94   95   96   97   98   99   100   101   102   103   104