如何在CSS中给出背景图像路径? [英] How to give the background-image path in CSS?
本文介绍了如何在CSS中给出背景图像路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的CSS文件位于:
Project / Web / Support / Styles / file.css
Project/Web/Support/Styles/file.css
我的图片位于:
Project / Web / images / image.png
Project/Web/images/image.png
CSS文件。
我试过:
1) background-image: url(/images/image.png);
2) background-image: url('/images/image.png');
3) background-image: url("/images/image.png");
4) background-image: url(../images/image.png);
5) background-image: url('../images/image.png');
6) background-image: url("../images/image.png");
但是。
在css文件中指定图像文件的路径的正确方法是什么?
What is the correct way to specify the path of image file in the css file ?
推荐答案
您的css在这里:Project / Web / Support / Styles / file.css
Your css is here: Project/Web/Support/Styles/file.css
1时间 ../
表示Project / Web / Support和2次../ ie ../../
Project / Web
1 time ../
means Project/Web/Support and 2 times ../ i.e. ../../
means Project/Web
尝试:
background-image: url('../../images/image.png');
这篇关于如何在CSS中给出背景图像路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文