How to create a webpage: how to create a webpage using the path _ HTML/Xhtml _ of an image file

Source: Internet
Author: User
This article is original on the web teaching network lightning. If you repost it, you can remove this sentence, but do not use any excuses or methods to change the content of the article. Otherwise, you will be at your own risk! For more information, see the author and source. A long time ago, many netizens have asked me similar questions, especially when some special image effects codes on this site are copied, the pictures are always invisible. This article is an original article by lightning. If you reprint it, you can remove this sentence, but do not use any excuses or methods to change the content of the article. Otherwise, you will be at your own risk! For more information, see the author and source.
A long time ago, many netizens have asked me similar questions, especially when some special image effects codes on this site are copied, the images are always invisible, here, I will write a related tutorial for these beginners. If you do not have any questions about this, please go away on your own!
The question of applying images on webpages, that is, the application of image tags on webpages, is summarized below!
1) image tagging overview.
If a webpage only contains text but does not have images, the image will be very important in the production of the webpage, And the HTML professional provides the mark to output the image to the webpage. This tag has the SRC, ALT, ALIGN, BORDER, WIDTH, and HEIGHT attributes.
2) attribute introduction.
SRC attribute. For a tag, its SRC attribute is an inevitable attribute, that is, in the tag, SRC must be assigned a value and is an indispensable part of the tag. At this time, IMG should be written in the following format:

The parameter value is the full name and path of the image file name.
We know that image files generally occupy much larger space than plain text files such as HTML files, while web design often requires many images to increase attractiveness, if these image files need to be added to the HTML documents, the HTML documents will become very large and the network transmission will inevitably be slow.
Tag does not actually add an image to an HTML document, but tells HTML: Which image file is used? Where? So that HTML can be called from the original location of the image file. This answers the question about the image file. The parameter value must also have the path of the image file so that HTML can find the image file somewhere.
In the parameter values of the SRC attribute, writing the path of an image file is often a problem for beginners.
The path of the image file can be relative or URL. The relative path refers to the path formed by the file to be linked or embedded into the current HTML document and the relative location of the current HTML file. Assume that the HTML file and image file (named as logo.gif) are in the same directory, you can write the code. If the image file is placed in a sub-directory of the current HTML file directory (assume that the sub-directory is named images, the Code should be. If the image file is placed in the upper directory of the directory where the current HTML file is located (assuming the upper directory is "home"), the relative path must be a quasi-URL, that is, ".. /"to indicate the developer's website, and then follow the path of the image file on the developer's website. For example, if home is a directory under the website, the code should be. If home is a sub-directory under the directory king Under the website, the code should be written.
Other attributes. The marked ALT, ALIGN, BORDER, WIDTH, and HEIGHT attributes are optional. The ALIGN attribute is the alignment of the image. The value of the parameter is left, center, and right. The BORDER is the BORDER of the image. The value of the parameter is greater than or equal to 0, the default unit is pixel. The WIDTH and HEIGHT attributes are the WIDTH and HEIGHT of the image. The default unit of the parameter is pixel. The ALT attribute is the text displayed when the mouse moves to the image, this attribute must be used when creating a webpage. What is the purpose of this attribute? It is the text that can be displayed when the image cannot be displayed for some reason, which increases user friendliness.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.