Slidify:如何从assets/img 文件夹中调用图像作为背景? [英] Slidify: How to call image as background from assets/img folder?

查看:34
本文介绍了Slidify:如何从assets/img 文件夹中调用图像作为背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 assets/img 文件夹中调用一个图像,因为我想以 ZIP 格式共享卡组,因此它们的路径与我为我的文件所做的路径不同.

I want to call an image from the assets/img folder, becuase I want to share the deck in a ZIP and therefore they won't have the same path as I do for my files.

我像往常一样修改了slidify.css"文件,但有一个到assets/img文件夹的路径.

I've modify the "slidify.css" file, as usual, but with a path to the assets/img folder.

这是CSS所在的路径:

This is the path where the CSS is:

D:\presentaciones\prueba\libraries\frameworks\io2012\css

图片路径:

D:\presentaciones\prueba\assets\img

索引路径:

D:\presentaciones\prueba

这些是我的尝试:

1.-

.title-slide {
  background-color: white;
  background-image:url("assets/img/star-bg.png");
}

2.-

.title-slide {
  background-color: white;
  background-image:url(assets\\img\\star-bg.png);
}

3.-

.title-slide {
  background-color: white;
  background-image:url("assets\\img\\star-bg.png");
}

4.-

.title-slide {
  background-color: white;
  background-image:url(".\\assets\\img\\star-bg.png");
}

5.-

.title-slide {
  background-color: white;
  background-image:url("..\\assets\\img\\star-bg.png");
}

推荐答案

由于css文件在文件夹路径/libraries/frameworks/io2012/css/,所以需要先上4层可以看到/assets/img/,所以应该是

As the css file is in folder path /libraries/frameworks/io2012/css/, it needs to go up 4 levels before it can see /assets/img/, so it should be

/* relative path */
background-image: url('../../../../assets/img/star-bg.png');

或者你应该可以使用

/* absolute path */
background-image: url('/presentaciones/prueba/assets/img/star-bg.png');

这篇关于Slidify:如何从assets/img 文件夹中调用图像作为背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆