I'm trying to mimic the behavior of Mobile Safari and create a StandardError.html file to display an image and some text about an error on webview when it fails to load. I'm having trouble getting an image to show when using Background-Image: url('image.png') css, but not when doing it all in html using a div. I'm not sure why one works and the other fails, any help would be greatly appreciated!
On a side note, any help with getting that image to center using html would be awesome!
Thanks!
Edit: HTML to center url:
<div name="backgroundImage"> <center> <img src="image.png"/> </center> </div>
This is a sample from an HTML page I'm loading in a webview it should work as a good guide to accomplish your task. I'm using CSS to position my element, and loading it using HTML. The css will center the image horizontally on a screen with a width of 320px (iphone width)
// in css block
#product {
margin: 0 auto;
position:relative;
width: 320px;
}
in html block
<div id="container">
<div id="product"><img src="products-product-in-library.jpg" /></div>
</div>
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.