Home > Article > Web Front-end > Image tag attributes in HTML_CSS/HTML
Image tag attributes in HTML
Images can make web pages more vivid and beautiful. The browser can display JPEG and GIF images. GIF images can only use up to 256 colors (that is, they can only be saved as 8-bit colors), while the JPEG format can be saved as 24-bit. For specific continuous tone The image has the best effect. However, although GIF images are not as good as JPEG images in terms of image quality,
they can be downloaded quickly given the storage space they occupy. Therefore, you should decide which format of images to use depending on the situation.
Inserting images into HTML documents is achieved through the
tag. This tag has a total of 9 attributes. Except for the attribute SRC, which cannot be defaulted, all other attributes are optional.
1. SRC attribute. SRC is Source. This attribute is used to indicate the location of the referenced image file. For example:
Absolute path notation:
Relative path notation:
The attribute parameter value of SRC is the URL of the image file. Note that relative notation can be used to identify the location of the image file
only when the image file and the HTML document are in the same directory.
Two, ALIGN attribute. The parameter values of the align attribute are top, middle, and bottom. They respectively indicate that the text adjacent to the image is located in the upper left, middle left, and lower right
of the image. For example:
How about another look at this?
Five, confirm the picture Properties like margins. The
tag uses the two attributes vspace and hspace to determine the size of the space between the image and its adjacent objects. The vspace attribute is used to specify the distance between an image and its vertically adjacent objects. hspave is used to specify the distance between an image and its horizontal adjacent objects. The parameters of these two attributes are numbers, indicating the number of pixels that are left at a distance of .
6. BORDER attribute.
When the browser calls the image, it will add borders of different widths to the image based on the size of the browser window and the original image. We can use the border attribute to specify the width of the image border
or cancel the border
. The parameter value of the border attribute is also a number, indicating the number of pixels occupied by the border width. For example:
Test page
Just see the effect.
The larger the border parameter value, the larger the border. 7. ISMAP attribute
This attribute is related to the hyperlink of the document. We will explain it in detail later.