Home > Web Front-end > CSS Tutorial > How to write absolute path in css

How to write absolute path in css

藏色散人
Release: 2020-12-21 10:08:37
Original
5329 people have browsed it

How to write absolute path in css: first check the local project directory; then import the image and enter the absolute path such as "background: url(E:/py_web/python/module/static/img/bg.png) ;" That's it.

How to write absolute path in css

The operating environment of this tutorial: Windows 7 system, css3 version. This method is suitable for all brands of computers.

Recommendation: "css video tutorial"

Writing absolute path in css

Writing absolute path in css needs to start from the drive letter , fill in the directory names one by one until the required files are found.

For example, a project directory is as follows:

How to write absolute path in css

If you want to introduce a certain image in css, you can write like this

background: url(E:/py_web/python/module/static/img/bg.png);
Copy after login

Note: /static/img /bg.png is also a relative path, which is relative to the root directory. If you want to use this path, you must first figure out what the root directory is. If your web framework can set the route to the root directory of the website's static files, such as setting it to a static folder, then the css path can be written as img/bg.png. If there is no setting, the root path generally corresponds to the root directory of the hard disk.

The above is the detailed content of How to write absolute path in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template