SVG rendering issue in Android Browser - android

In the default Android Browser for older Android versions (4.1, maybe 4.2/4.3 [It is on the Android device of a customer, i'm not exactly sure which version he uses]) SVG sprites are not rendered correctly.
Instead of showing the correct clipping with the correct size, the browser shows a smaller version of the image, showing the whole sprite, like in the screenshot below (Android Browser 4.1):
Android screenshot (false rendering)
it should look like this:
Android screenshot (correct rendering)
Here's the CSS for the sprites:
.sprite {
display: inline-block;
background-image: url('img/sprite.svg');
background-repeat: no-repeat;
background-size: 1000px 1000px;
overflow: hidden;
color: transparent !important;
}
.sprite.logo {
width: 270px;
height: 55px;
background-position: 0 0;
display: block;
}
[...]
Every other Browser (including Android Browser 4.4) shows everything correctly.

This issue exists on Android 4.3- and IE9. To solve this, simply specify width and height attributes for svg tag in you file.

Related

Thin linear gradient doesn't display in Firefox for Android

I'm creating a menu that has elements underlined with a gradient line. The gradients display fine on desktop and in Chrome for Android, but don't show in Firefox for Android. I used the Firefox WebIDE to debug the error.
Here's my code:
<div class="menu">
<div>Menu1</div>
<div>Menu2</div>
<div>Menu3</div>
<div>Menu4</div>
<div>Menu5</div>
</div>
.menu > div {
position: relative;
cursor: pointer;
text-align: center;
}
.menu > div:after {
content: "";
position: absolute;
bottom: -0.05vw;
left: 5%;
width: 90%;
height: 0.05vw;
background-image: linear-gradient(90deg, transparent, white 25%, white 75%, transparent);
}
On Chrome for Android it's very thin, just as I'd like.
It seems that 0.05vw is too thin to for FF for Android to display, because from 0.13vw and up it starts to show, but it's too thick that way. calc(0.4px + 0.05vw) shows and it's a little better that way, but still too thick.
If I ditch the gradient in favor of a solid white background, it shows and is thin, so currently I'm using that as fallback, though not ideal.
Phone is a Galaxy S4 with FF for Android 67.0.3.
Is there a way to make it display, or do I need to solve it in a different way?

Front page hero background image improperly scaled on Mobile

On my wordpress site, the background for the front page hero is improperly scaled on mobile devices (iOS and Android). It only shows a fraction of the image as opposed to the full image.
I have tried:
-changing the resolution and sizing of the image
-Unwanted scaling on mobile devices (Inserted the meta tag but no changes propegated, yes I cleared cache too)
-Site scaling on a mobile device (I tried testing CSS changes through USB debugging but it did not work)
I am using the Brooklyn theme created by United Themes. The site also utilizes Visual Composer.
Site: https://www.wearerubbish.com
Current CSS
#media (max-width: 767px)
.parallax-section {
background-position: center center !important;
background-repeat: repeat-y !important;
/* background-attachment: fixed !important; */
background-size: cover !important;
}
An example would be nice so we can take a look at the code, but usually I fix those problems by adding a max-width property with a value of 100vw if the hero is full width and it is a <img> tag. But if the image is a background-image a background-size: cover; will do just fine.
You can try this css
.hero .parallax-scroll-container {
background-size: contain!important;
}

Background image bottom-right alignment error - chrome on android

I have a website that requires a 'bottom right' background image alignment, along with a background colour of #000.
My css tests okay on all OS and browsers I've tried so far (chrome, ie, moz, safari) except for chrome on android, which renders the background image outside the browser window.
Other image alignments work fine - the problem seems to be only with bottom right alignment, and only with chrome on android.
Problem page url: Features a background-image: bottom right alignment
CSS as follows:
body {
box-sizing: border-box;
margin: 0;
padding: 0;
font-size: 1em;
background: url("../images/bg_prices_XL.jpg");
background-size: contain;
background-color: #000;
background-repeat: no-repeat;
background-position: bottom right;
background-attachment: fixed;
}
If I change alignment to background-image: top right; then the problem goes away.
Page renders properly on android moz. Do I therefore need to include a -webkit specific alignment?
Havd tried adding:
html,body {
height 100%;
width 100%;
}
...but no luck. Viewport size already set to device size, Chrome seemingly is rendering oitside the viewport anyway, below the footer.
Tried styling the background-image under html section of css, but didn't work.
All thoughts welcome.
I have inspected the page throught chrome dev tools. I think if you remove background-attachment: fixed; propery it will work.
...never mind folks. I made the background a fixed, 100% height and width div, with a negative z-index. It feels like a clunky workaround to me, but it seems to work. Any better suggestions though would be appreciated thank you.

background-attachment: fixed on mobile

I'm trying to set a background image for an spn web app and I need the background to be fixed (that it won't be scrolled with the rest of the page).
this is the body css:
body {
background-color: rgb(51, 102, 102);
background-image: url('../images/background.png');
background-attachment: fixed;
background-position: center;
color: #eee;
}
Safari in IOS and Chrome on Android repeat the background instead of fixing it at one point.
I've seen on the internet it's been disabled on mobile but is there a solution?
background-repeat: no-repeat;
background-position: center center;
There are other options to doing this but this is the only one that actually worked for me; and i tried just about all of them.
You set the div just below the initial tag. Then apply the image to the html within the div. Give the div and id attribute as well (#background_wrap in this case).
...I tried this without applying the actual image link within the html and it never worked properly because you still have to use "background-image:" attribute when applying the image to the background within css. The trick to getting this to work on the mobile device is not using any background image settings. These values were specific for my project but it worked perfectly for my fixed background image to remain centered and responsive for mobile as well as larger computer viewports. Might have to tweak the values a bit for your specific project, but its worth a try! I hope this helps.
<body>
<div id="background_wrap"><img src="~/images/yourimage.png"/></div>
</body>
Then apply these settings in the CSS.
#background_wrap {
margin-left: auto;
margin-right: auto;
}
#background_wrap img {
z-index: -1;
position: fixed;
padding-top: 4.7em;
padding-left: 10%;
width: 90%;
}

Text got blurred on Android Webview

I'm developing a web based app. I load a page on an android WebView.
The issue is, I set a wave border effect to a div using css3 radial gradient, the page shows correctly on most browsers, and works fine for iOS version app as well. But on the android app, If I add this style, the page will totally become blurred. I paste my css code here:
wave-l:before{
display: block;
position: absolute;
content: '';
top: 0px;
left: -4px;
height: 100%;
width: 4px;
background-position: 0px 0px;
background-size: 4px 8px;
background-image: -webkit-radial-gradient(100% 4px, circle, $color 4px, transparent 4px);
background-image: -moz-radial-gradient(100% 4px, circle, $color 4px, transparent 4px);
background-image: radial-gradient(circle at 100% 4px, $color 4px, transparent 4px);
}
This css will generate a left wave style border. The blurred pages shown on android WebView is as shown below:
I'm quite sure it's this css code snippet caused the issue. So anybody know the solution?
Add the code
android:hardwareAccelerated="false"
in the AndroidManifest.xml webview used activity.
It is too late to respond, but I was also getting the blurred issue in webView. I resolved it by adding
webView.getSettings().setJavaScriptEnabled(true);
It may help somebody

Categories

Resources