简体   繁体   中英

content url for local image file not working in Windows Phone 8 application

I had created a IBM Worklight project and its working fine for android and IOS, but with wp8 it's not working.

All the local image files are added to HTML DOM by using id in the image tag and providing url to content property, but for wp8 i have to provide inline src to call the images.

My question is how to call local images in the same way through external css file in windows phone?

I had tried calling the image from root folder but its not working ie, content:url("www/default/images/abc.png");

Windows Phone 8 file path handling differs than other environments. Your path should be relative. You can look at the multiple pages tutorial's sample project for special handling done for this purpose. Although you're done this in the HTML, so it's gonna be a bit of a problem...

By why not do this via CSS?
For example, if you have some DIV and you can want to give a background using an image that exists locally in the application's web resources, you can do this:

HTML:

<div id="test"></div>

CSS:

#test {
    background-image:url("../images/icon.png");
    height: 30px;
    width: 30px;
    display:inline-block;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM