Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background-size:cover not working in android native browser

I'm trying to fit a background image to it's container using background-size:cover. here is my fiddle : The Fiddle

it works in all browsers but not working in Android native browser.. anybody has any solution please ? thanks

like image 262
Payam Shakibafar Avatar asked Dec 08 '13 09:12

Payam Shakibafar


People also ask

Why does my background image not cover the whole page?

Try setting your header to height: 100% . Alternatively (the better solution), set the background on the body if you want it to cover the whole page.

How does background-size cover work?

If the background-size is contain or cover : While preserving its intrinsic proportions, the image is rendered at the largest size contained within, or covering, the background positioning area. If the image has no intrinsic proportions, then it's rendered at the size of the background positioning area.

Is there a size limit for background images in the browser?

Browsers have a limit to the file size they'll display as a background image. Make sure you're not trying to put a billboard sized image where a notebook sized image belongs.

How does background-size affect the size of the image?

If the background-size is contain or cover: While preserving its intrinsic proportions, the image is rendered at the largest size contained within, or covering, the background positioning area. If the image has no intrinsic proportions, then it's rendered at the size of the background positioning area. If the background-size is auto or auto auto:

What is the difference between auto and specified background-size?

If both components of background-size are specified and are not auto: The background image is rendered at the specified size. If the background-size is contain or cover: While preserving its intrinsic proportions, the image is rendered at the largest size contained within, or covering, the background positioning area.

What is the background-size CSS property?

The background-size CSS property sets the size of the element's background image. The image can be left to its natural size, stretched, or constrained to fit the available space. The source for this interactive example is stored in a GitHub repository.


1 Answers

After searching about this problem and finding no solution, I deleted background-image from CSS file styles and used an inline style in HTML codes. The problem with android native browser is solved.

I updated the fiddle and it's working in android native browser.

The Updated Fiddle

it seems that android also has problem with parsing background format like this :

background: url('...') fixed center center / cover;

and we should separate the background-image form others and use it inline, and then use each option separately in css file, like this :

background-size: cover;
background-position: center center;
like image 79
Payam Shakibafar Avatar answered Nov 08 '22 18:11

Payam Shakibafar