How to use absolute paths and relative paths in html
When we reference files, each path is different. Today we will discuss the similarities and differences between absolute paths and relative paths, so that we can distinguish reference paths in the future. Pros and cons.
Relative path: The directory path created based on the location of the web page that references the file. Therefore, when web pages saved in different directories reference the same file, the paths used will be different, so it is called relative.
Absolute path: The directory path based on the root directory of the Web site. The reason why it is called absolute means that when all web pages reference the same file, the paths used are the same.
In fact, the difference between absolute paths and relative paths lies in the reference points used when describing directory paths. Since the reference point of the root directory is the same for all files on the website, the path description method using the root directory as the reference point is called an absolute path.
Path special symbols
The following are several special symbols used to establish paths and their meanings.
"." -- Represents the current directory, relative path. For example: text or
".." -- represents the previous layer Directory, relative path. For example: text or
"../../" -- represents the directory above the previous directory, a relative path. For example:
"/" -- represents the root directory, absolute path. For example: text or
"D:/abc/" -- represents the root directory ,absolute path.
When using relative paths, we use the symbol "." to represent the current directory, and the symbol ".." to represent the parent directory of the current directory.
Popular explanation of path
Absolute path As the name suggests, filling in the absolute directory path address is called an absolute path. Usually we directly use "/" to represent the directory path starting from the root directory. This is called an absolute path. .
Relative path As the name suggests, when filling in the directory, use the directory file as a reference. Use "../" or "./" to point to the previous level or use "../../" to point to the previous level. It's called a relative path.
Referencer ../SubDir2/BeRef1.gif .htm divcss5.gif ../../Dir1/SubDir2/ BeRef1.gif . /Dir1/SubDir2/ BeRef1.gif
url3.htm abc1.htm ../../Dir2/ abc1.htm ../../Dir2/ Dir2/abc1.htm
url4.htm abc2.htm ../abc2.htm /Dir2/abc2.htm
Description:
We use "/", " ../" and "../../" respectively style and introduce the relative absolute path relationship between the
picturepath and the URL path.
What are the functions of absolute paths and relative paths? Relative paths and absolute paths can be converted to each other. Just pay attention to the correct path when converting. The effect is the effective link path.
What is the relationship between relative path, absolute path and CSS?
1. When we introduce image addresses in CSS, we may use relative paths and absolute paths.
2. We introduce CSS files in HTML in DIV+CSS html and import
When adding pictures, relative paths and absolute paths will be used
The above is the relationship between absolute paths and relative paths. I believe everyone has understood it clearly through our introduction. For more exciting content, please pay attention to php Chinese website
OtherRelated reading:
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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
