Home  >  Article  >  Web Front-end  >  Big Brother and Big Sister solve the comprehensive usage of the attribute src in the img tag_html/css_WEB-ITnose

Big Brother and Big Sister solve the comprehensive usage of the attribute src in the img tag_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:47:541079browse

If the html file is in the qw folder of the c drive and the image is in another folder of the c drive, how can I reference this image in the html file? ? ? Big sisters and brothers ask for solutions


Reply to the discussion (solution)

../folder name/xxx.png

This is the same as src It has nothing to do with the usage. It's actually a problem with the image path.
There are several ways:
1. Absolute path method. The premise is that your web server can access the path of the image
2. Relative path method. Similarly, you need to ensure that the server can access the image
3. Web method. Such as http://www.test.com/aa.jpg

There are several ways to express

There are several ways to express


relative path Just remember that ../ represents the upper level folder. ../../ represents the upper two levels of folders, and the same goes for the upper three levels../../../
When writing a relative path, you must first use ../ to return to the current file and target file common upper-level folder, and then find the target file from this upper-level folder
Statement:
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