In the web front-end, the relative path refers to the path relationship with other files (or folders) caused by the path of the current file. It is the target file location relative to the current file; in simple terms, it is Use the current file as a reference point to determine the paths of different files. Relative paths generally start with "./" or "../". Benefits: When the entire project is moved, the relative relationship between files within the project does not change, and the previously set paths are still accurate and do not need to be modified.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
First of all, you must understand the concepts and differences between relative paths and absolute paths:
##Relative paths:
The relative path refers to the path relationship with other files (or folders) caused by the path of the current file. Using relative paths can bring us a lot of convenience.Absolute path:
The absolute path refers to the absolute location under the directory, directly reaching the target location, usually the path starting from the drive letter. The path that completely describes the file location is the absolute path, which is the directory path based on the root directory of the web site. The absolute path name is specified from the root directory at the top of the tree directory structure to a directory or file. It consists of a series of consecutive directories separated by slashes until the directory or file to be specified. The last name is the directory or file to point to. The reason why it is called absolute means that when all web pages reference the same file, the path used is the same.Personal summary:
Relative pathIn short, it is relative to where you are Directory to refer to other files (not the root directory), which is the target file location relative to the current file.
One advantage of this is that when you move the entire project, the relative relationship between the files in your project does not change, and the path you set before is still accurate. For example: There are two files index.html and image.jpg under the web server folder a. Image.jpg is introduced into the index.html file. As long as the relative positions of the two files have not changed (that is, they are still under folder a), then this path will be correct no matter where it is uploaded to the web server.
Absolute pathStarts from the relative root directory (disk), and the path used by each file is the same.
Using absolute paths can prevent the website from being maliciously plagiarized. The default link for plagiarism still points to your own website. As long as the location of the target file on the page remains unchanged, your link will still point to the correct URL. Absolute paths are rarely used in web development because the paths in your local environment and the server may be different. / represents the root directory of the file.
Explain through examples
Below I will illustrate relative paths and absolute paths from examples in the most commonly used html on the web. The difference:1. Absolute path
For example:# #Another small example:
For example, if you want to use a file when using a computer, you need to know the location of the file. For example, if there is a file index.html, you need to use the image index.png:
D:/websize/image/index.htmlyou You can reference this image using the path
. Everything will work fine on your computer. But when developing, you basically don’t use absolute paths. Because it is difficult to transplant the project, your pictures cannot be accessed on other computers (he does not have your pictures on his computer)
.
(recommended for actual use) First understand:
- . . /
Represents the upper-level directory of the current file
- ./
Represents the directory where the current file is located
For example :
Here is a small example:
For example, there are two WEB folders under your E drive. files access each other.
E:/WEB/mar/img/index.htmlIf you want to access
from index.html
, the path is . ./image/ig/ip/pho. png
;<p>If you want to access <code>index.html
in turn, the path you need is . ./. ./. ./img/index.html
Summary:
Both relative paths and absolute paths are used in web development, each with its own advantages and disadvantages. To summarize briefly, relative paths use the current file as a reference point to determine the paths of different files. Relative paths generally start with ./, ../. Of course, if the file is a directory of the same level, ./ can omit the absolute path. Determine the path of the file based on the computer file or the absolute address on the network. The absolute path usually starts with the drive letter under Windows, / starts under Linux (but in the Web server, / represents the root directory of the Web server), or Start with a URL.
(Learning video sharing: Getting started with web front-end)
The above is the detailed content of What is relative path in web frontend. For more information, please follow other related articles on the PHP Chinese website!

web前端工程师是从事Web前端开发工作的工程师,主要工作是进行网站的开发、优化、完善;主要职责是利用各种专业技术进行客户端产品的开发,然后结合后台开发技术模拟整体效果,为网站上提供的产品和服务实现一流的Web界面,优化代码并保持良好兼容性,致力于通过技术改善用户体验。

web前端框架有:1、Angular,一种用于创建单一应用程序界面的前端框架;2、react,一个用来构建用户界面的JavaScript开发框架;3、vue,一套用于构建用户界面的渐进式JavaScript框架;4、Bootstartp,是基于HTML、CSS、JavaScript的前端框架;5、QUICK UI,一套企业级web前端开发解决方案;6、SUI,一个前端组件库。

本篇文章给大家总结一些值得收藏的精选Web前端面试题(附答案)。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

本篇文章给大家总结一些值得收藏的精选Web前端面试题(附答案)。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

web标准的好处有提供更好的跨平台兼容性、可访问性、性能、搜索引擎排名、开发和维护成本、用户体验以及代码的可维护性和可重用性。详细说明:1、跨平台兼容性,确保网站在不同的操作系统、浏览器和设备上都能正确显示和运行;2、提高可访问性,可以确保网站对所有用户都是可访问的;3、加快网站加载速度,用户可以更快地访问和浏览网站,提供更好的用户体验;4、提高搜索引擎排名等等。

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

云计算与web前端有挂钩。云计算在web前端的体现就是可以到云里拿一些资源来支撑业务;这些资源可以是计算能力、存储空间等硬件资源,也可以是各种应用、服务甚至桌面等软件资源。再次细分之后可以看到,当云计算体现到前端时,终端用户获得的要么是应用,要么是桌面;那桌面云的概念就应运而生了。桌面云的重点也在于应用,为用户搭建了种种桌面云应用环境,解决用户所遇到的各种业务问题。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
