The compatibility of Cordova CSS properties varies across different devices

I am currently using the ionic framework to develop my upcoming app. I encountered an issue while trying to set a background SVG image for body. The background displayed perfectly on desktop browsers like Firefox and Chrome, as well as on my Nexus 4 device. However, when I tested it on a Xiaomi Redmi device owned by a friend, there was a gap between the top and bottom of the background image.

Screenshot from the Nexus:

Screenshot from Xiaomi:

You can see in the images that the background position is not starting from the top as intended. When testing on another device, Alcatel, the same gap persisted, only larger this time. On Motorola G and Samsung Galaxy S5, the background image displayed perfectly.

The CSS code applied to body is as follows:

body {
    background-image: url("../img/bg.svg") !important;
    background-repeat:no-repeat !important;
    background-position:0 0 !important;
    height:100vh !important;
    width:100% !important;
    background-size:100% 100% !important;
    padding:0 !important;
    margin:0 !important;
    position:relative !important;
    background-attachment:fixed !important;
}

Here is a snippet of my SVG file:

<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="1.06666in" height="1.6in" version="1.0" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 1067 1600"
xmlns:xlink="http://www.w3.org/1999/xlink">

<!-- SVG path data along with styling attributes -->

</svg>

Answer №1

It seems that the discrepancy in appearance between KitKat and Lollipop versions of Android may be due to differences in rendering, as Wayferer pointed out.

To tackle this issue, there are a few approaches you can consider:

  1. One option is to ensure uniformity across your Android installations by utilizing the Crosswalk plugin. This tool replaces the WebView with the most up-to-date Chromium browser, ensuring consistency on all devices running Android version 4.0 and above. However, keep in mind that this method may limit support for older Android versions, compatibility with PhoneGap build, and increase the app's download size due to the embedded browser component.

  2. If you prefer to troubleshoot the discrepancies without relying on Crosswalk, you can investigate potential issues with HTML/CSS classes using resources like caniuse.com. Additionally, performing remote debugging on the older device can help identify problematic elements causing the display differences (instructions available at: https://developer.chrome.com/devtools/docs/remote-debugging).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubles with modal functionality in Ionic application involving ion-slide-box

Utilizing ion-slider to display images has been a seamless experience, except for one hiccup. If I navigate directly from the first full image back to the home screen, the slider ceases to function properly. To address this challenge, I have employed spec ...

Angular neglects the specified animation timing

I created a sidebar component that relies on the sidebarExpanded state passed through Input(). Despite the correct animation trigger upon input change, the width adjustment happens abruptly. Interestingly, the same animation code works flawlessly in anothe ...

What are some creative ways to customize the background of a MaterialUI modal design?

I am currently facing an issue with my MUI Modal setup. The backdrop is displaying as black even though I have proper styling in place. No matter what I do, the backdrop remains pitch black and does not update. Below is the code snippet along with a scree ...

revealing the hidden message on the back of the card

I have been working on creating flipping cards for my website using CSS, but I am facing an issue. Even after styling my cards as per the provided CSS code, I am unable to make them flip when I hover my mouse over them. .row { padding-top: 25px; } .c ...

Display corresponding div elements upon clicking an HTML select option

Is there a way to make a div visible when a corresponding select option is clicked, while hiding others? My JavaScript skills are lacking in this area. CSS #aaa, #bbb, #ccc { display:none; } The HTML (I'm using the same id name for option and d ...

What is the best way to align row elements in Bootstrap?

Hey there everyone! I've been grappling with a challenge for the past few days on how to center the contents of a Bootstrap row. Let me elaborate: The row has 12 columns (as is standard in Bootstrap). However, in my design, I'm only utilizing 9 c ...

Creating a tiny arrow using CSS

Can anyone advise on the best way to create a small arrow design using CSS? I have tried using a regular closing > arrow, but it's not quite what I'm looking for. https://i.stack.imgur.com/7uLMG.png ...

Looking for a way to prevent a div element from scrolling in JQuery Mobile?

Here is my implementation: http://jsfiddle.net/coderslay/Lhb5Y/ I have content structured like this: <div data-role="content"> <div><!--Contains a button --></div> <div><ul>..<!--Contains a list -->...</ ...

How can CSS image hover affect the layout of other elements on the page?

When I hover over the image and it grows to 350px, it causes everything around it to shift. The code is functioning as expected, but the issue arises when the enlarged image pushes nearby elements downward. Is there a way to prevent this behavior? #disp ...

To populate an Ionic list with items, push strings into the list using the InfiniteScroll feature

Looking for help with implementing infinite scroll in a list? I am using the ion-infinite-scroll directive but struggling to push string values into my list. The list contains names of students in a classroom. Can anyone provide guidance on how to push str ...

Ways of incorporating text in a parallelogram shape

Here is the HTML code with ID attributes applied to both divs: <div id="herotext"> <div id="banner"></div> <h1 id="maintitle">Hey, I'm Charlie</h1> <p>This websi ...

`CSS animation for vanishing line effect`

I want to create an animated logo that gives the illusion of being pulled up by a rope, represented by a vertical black line, from the bottom of the page to the top. As the logo moves upwards, I would like the rope to disappear behind it, but I'm uns ...

Angular is encountering a CORS issue with the "No Access-Control-Allow-Origin" error when trying to access a CSS file

Currently, in my Angular 5 application with a Web API back-end, my main goal is to reference a CSS file on a production server. I'm facing a cross-origin issue when trying to access the CSS file hosted on the IIS server website. Even though CORS is e ...

Responsive CSS Fluid Grid Design Encounters a Tablet Break Point Failure

During the development of a responsive website in Dreamweaver CS6 using the Fluid Grid system, all breakpoints were initially functioning correctly. The site had distinct layouts for desktop, tablet, and mobile devices, each with different resolutions that ...

Preventing click events with pointer-events property in CSS while still allowing scrolling

Is there a way to use pointer-events: none to disable click events on a specific container while still allowing scroll functionality and an overlay? You can view my fiddle here: https://jsfiddle.net/1eu6d3sq/1/ Currently, when I apply pointer-events: non ...

Alignment of text to the right in a two-column div design

I'm trying to figure out the most effective way to have a block of text aligned on the left and another block of text aligned on the right within a div. Here is an image that illustrates how I want it to appear Initially, I considered using three se ...

Leverage the power of data binding in Typescript Ionic by exposing object functions

Is there a way to execute a function on a Typescript model object within an Ionic HTML template? Whenever I try to do so, it triggers an error message saying self.context.$implicit.myFunctionName is not a function. In my Ionic2 app, I am aiming to showcas ...

The close modal button is unresponsive in Bootstrap

I am currently integrating a modal into my existing HTML page. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="height: 100vh !important"> <div class="modal-dialog" role="document"> ...

Upon the initial hover, the data added to the title tag following an Ajax call is not appearing

I am currently working on an ajax request that retrieves information such as username, email, and user_id. Once the ajax call is successful, I use jQuery to append this data to the title tag. The main issue I am facing is that the data is only displayed af ...

What is the best way to assign a class to a read-only field in HTML and CSS?

My situation is as follows: I have jQuery code that uses an if-statement to add a specific class to an element based on the selected value on a form page. I also created another form where users can view the details of a previously filled out form. However ...