【发布时间】:2014-04-18 16:31:04
【问题描述】:
我是 mvc 应用程序和在 aspx 视图引擎中创建站点的新手。 我在 mycss/style.css 中有一个 css 文件,图像在 images/img1.jpg 中。 有什么区别
background: url("../images/img1.jpg") no-repeat;
and background: url("~/images/img1.jpg") no-repeat;
在 style.css 中
【问题讨论】:
-
我不认为
~/可以在 css 文件中使用。 -
文件路径中的点(./Images)和双点(../Images)有什么区别?
-
../Images表示上一个目录,然后下到Images文件夹。./Images表示进入当前目录下的Images文件夹。 -
你是说这两种方式都适合你吗?
-
这个thread 解释了css url是如何在后台工作的[1]:
标签: html css asp.net-mvc