What is the code for adding a picture in HTML? How does HTML correctly add a picture path?

Source: Internet
Author: User
This article is mainly about the HTML to add a picture of the Code interpretation Analysis, as well as the correct use of HTML image path, let's take a look at this article

First, let's look at the code for adding a picture in HTML:

HTML added to the picture is the tag, is a single label, can be pulled from any place to add the picture, but you have to correctly determine the path to add the picture, otherwise it will not show the picture, this is what we say today two points of knowledge.

Let's look at the correct use of the IMG tag to determine how to add a picture.

The general syntax for adding pictures is as follows:

As above, the SRC attribute is the necessary attribute in IMG, otherwise img is useless, no place to put the picture, then this label to do, so, we want to know the use of HTML IMG tag, these two are linked together, we have to use together. (Want to see more HTML knowledge, Welcome to Topic.alibabacloud.comHTML Programming Course)

And our local production of HTML to add images are generally placed in their own local folder, and HTML files together, is generally a document, there is an HTML, there is a folder called IMG is specifically used to put pictures of the folder, We usually put the images we want to upload into the IMG folder. Then we can use the IMG tag to link the local image:

As above is generally we use the IMG tag usage, link the local image 1.jpg, put the picture on the page.

Now let's say the correct way to use it:

Above said, we usually put the picture in the local folder, so that we can directly link the picture, such a way is very good, how to beautify the picture better, it is recommended to use cascading style sheet CSS to implement, but we are now talking about pure HTML tags and attributes to achieve, So let's not talk about CSS styles.

We imagine, is generally used ,1.jpg This is the name of the local picture, of course you can change casually, this is OK. This is our most popular usage.

Let's see how other pictures are connected, such as the pictures we want to connect to other folders, what should we do?

Let's take a look at the syntax used by the situation:

This will come out, for example, we are connected to the E-disk "Wenjian" folder under the "Tupian" folder under the 1.jpg picture.

This is also a common use, some pictures other documents also need, this is the best, put the picture in an easy to find location. So you can keep using it all the time.

There is also a link to the image of the internet :

If you want the Web site image, right click on the website image to copy the image URL. This will allow you to copy the URL of the image.

Then we use the IMG tag to put the picture on our own page. Such as:

This is the ability to call the picture on their own page to show that it is a bit of trouble. You can try these kinds of methods more.

This article about the picture tag code and the correct way to use the path is finished (want to learn more label knowledge, come to topic.alibabacloud.com, here are all you want to learn the programming course, absolutely you learn programming is the only way), the problem can be asked below.

Related Article

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.