Home > Web Front-end > CSS Tutorial > Image tag attributes in HTML_CSS/HTML

Image tag attributes in HTML_CSS/HTML

WBOY
Release: 2016-05-16 12:11:58
Original
1831 people have browsed it

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 Image tag attributes in HTML_CSS/HTML 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:
Image tag attributes in HTML_CSS/HTMLRelative path notation:
Image tag attributes in HTML_CSS/HTMLThe 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:



Test page




me Does the icon look good? Image tag attributes in HTML_CSS/HTML





How about another look at this?

Image tag attributes in HTML_CSS/HTML





You can change the image to your own. Note that the browser's default directory is the windows/TEMP temporary folder. You need to specify the directory where the image is located.
Four, ALT attribute. When users browse the web, they often choose not to download images to save time or for other reasons. Adding the ALT attribute can display some information about the image in the
position where the image is originally displayed. The parameter value of the ALT attribute is the text information that the web page editor hopes to appear where the image is originally displayed. Generally,
is the name and brief description of the image. For example.



Test page




Image tag attributes in HTML_CSS/HTML Can't you see it? Hehe










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 Image tag attributes in HTML_CSS/HTML.
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. Image tag attributes in HTML_CSS/HTML








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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template