Slidify: How to call image as background from assets/img folder?

做~自己de王妃 提交于 2019-12-12 04:02:45

问题


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.

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

This is the path where the CSS is:

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

Path to the image:

D:\presentaciones\prueba\assets\img

Path to index:

D:\presentaciones\prueba

These were my attemps:

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");
}

回答1:


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');

or you should be able to use

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


来源:https://stackoverflow.com/questions/35280879/slidify-how-to-call-image-as-background-from-assets-img-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!