问题
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