Issue with webkit-box-reflect causing errors on Android devices

I have been attempting to incorporate a reflection effect on a mobile webview application (specifically for Android and iOS using webkit). I followed examples I found on various websites, including Stack Overflow.

"-webkit-box-reflect: below -14px -webkit-gradient(linear, left top, left bottom, from(transparent), to(white));"

On Android, the result looks like this

And on other webkit browsers, it appears like this

As seen on Android, there is no actual reflection; instead, the gradient is applied directly onto the reflected image. It seems to be a masking issue specific to webkit on mobile devices. While I could change the color to something other than white (like green) and reverse the orientation, I require an image as the background rather than just a solid color.

Does anyone have any ideas or suggestions? Most resources I've come across do not mention Android at all or only showcase their work on plain backgrounds...

Answer №1

Unfortunately, the Android browser does not support webkit gradients as masks on box-reflects. However, as Ali.MD pointed out, you can use PNG images for the masks instead.

To avoid the need for an additional HTTP request, you also have the option to convert the PNG to a Data URI using a tool such as :

img {
  -webkit-box-reflect: below 0 
  url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAyCAYAAACUEBHwAAAAIklEQVQ4jWP8//8/AzpgwhAZFRwVHBUctIIsDAwMXFQWBAAW4QORoT0UUQAAAABJRU5ErkJggg==);
}

Answer №2

Opt for a Transparent Image as a Mask

-webkit-box-reflect:below 0px url('image.png');

This technique proved successful on my Android 2.3 device.

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

What is the best cross-platform app development framework for creating mobile applications and user interfaces

Currently working on a web project using either Rails or Django, I am also looking to develop a mobile app that supports Android and iOS operating systems (potentially others as well). Considering various options, such as using Qt. What are your recommend ...

Tips for incorporating unique images into each individual flex box

I am new to the world of coding, having just embarked on this journey less than a week ago. Following a tutorial by a developer on YouTube, I tried to add my own twist to the project in order to differentiate it from the original. However, I've hit a ...

Navigation dropdown menu with the latest Bootstrap 4 features

Attempting to recreate the design from Codepen using Bootstrap 4. The current progress can be viewed in this Codepen (drop down with 2 columns), which is assisting with online tutorials. Here's the HTML for the Navbar: <nav class="navbar navbar- ...

list of current items on the sidebar that are currently being

Hey everyone, I could use some assistance with customizing my sidebar design. I am trying to implement an active state in my sidebar using JavaScript. I attempted to utilize the element.css() method to apply styles when an element is clicked. However, I no ...

Automatically reduce the size of a button without any user interaction

Is there a way to implement a menu button on my website that appears as a simple circle with an icon in the top right corner? I want it to initially load at a specific height and width, and then automatically shrink after a few moments to a different heigh ...

When I try to host my Jekyll site on GitHub Pages using my custom domain, the CSS doesn't seem to be rendering at all

Everything looks perfect when I test my site on local host, but once I push it to my GitHub repo, only the HTML appears with no CSS or JavaScript. I've attempted changing my URL in the config.yml file to https://chanvrequebec.com and modifying href="/ ...

"Modify the CSS color of h1 based on the presence of a specific class containing spaces in a div

I am currently attempting to modify the color of a heading by referencing a specific div's class. My attempts so far include: .pagetitle-title.heading { color: purple; } <div class="container"> <h1 class="pagetitle-title heading">I ...

Having trouble retrieving JSON data from the server in an Android application

I have been working on an Android project where I need to fetch a JSON file from a specified URL. This JSON file contains the URLs for both the video and the image thumbnail that are supposed to be displayed in the app. However, I'm encountering an i ...

Customizing CSS in apostrophe-cms Pro using TheAposPallete.vue

Just starting with apostrophe-pro and I've noticed a file named TheAposPallete.vue in the node_modules directory, located at \node_modules@apostrophecms-pro\palette\ui\apos\components This file contains the following CSS: ...

"How can I configure the total number of chats to be displayed as notifications on the Twilio chat app badge

Issue: I am receiving push notifications from twilio chat, but my app has 4 different chat channels. When the notification includes the "bage" field, it only shows the count of chats with new messages, not the total number of unread messages. How can I ca ...

Using PHP, JavaScript is unable to hide <div> elements

I'm encountering an issue where the div I want to show when an error occurs is not hiding and showing properly using JavaScript. Here is a snippet of my code: <script> function hideerror() { var catdiv = document.getElementById(error); ...

Extension Overlay for Chrome

I'm currently working on developing a Chrome extension, but I'm encountering some confusion along the way. Despite researching online, I keep receiving conflicting advice and haven't been able to successfully implement any solutions. That&ap ...

Troubleshooting Firefox HTML Positioning Problem (Functioning Properly in IE and Chrome)

After implementing the code below, I encountered an issue. In IE and Chrome, when hovering over the "CODE" section, the div correctly appears at position 100 x 100. However, in Firefox, the div fails to move to the specified position. What changes should b ...

Are there any reliable charting APIs available that can efficiently handle the lazy-loading of large data sets using Ajax while scrolling or zooming?

Hey there! I need help finding a JavaScript charting API that allows me to query the server using specific bounds on the horizontal and vertical axes in order to retrieve new data points. Just to give you an idea, the dataset I'm working with is incre ...

There seems to be an issue with the task configuration on Android - the problem is that an expected input file is missing

Recently, I updated my Android project to Kotlin 1.9, Java 17, and Gradle 8.2. On my local machine, everything builds successfully, but the build fails on bitrise.io with the following exception: FAILURE: Build failed with an exception. * What went wrong: ...

Can we implement attribute selectors in Material-UI while utilizing makeStyles?

Is it possible to extract all the div elements with specific Mui class names such as access-MuiPickersCalendarHeader-switchHeader, access-MuiPickersDay-day? My components are styled using StylesProvider which adds "access" as a prefix to the original Mater ...

Regrettably, the app has encountered a problem and has stopped functioning - error notification on AVD/Eclipse while running a new/default

After installing the ADT/Eclipse bundle on my Windows 7 (64 bit) system, I encountered an issue where every time I attempted to run an application on the emulator, it displayed a message saying "Unfortunately, app has stopped". Despite researching this err ...

javascript An interactive accordion component created with Bootstrap

I have been searching for a solution to create an accordion-style collapsible set of panels where the panels remain separate and do not have headers. I want buttons on one side, and when clicked, a panel is displayed on the other side. Only one panel shoul ...

What steps should I take to switch the provider to GPS_provider on an Android phone that does not have an internet connection?

I have developed a location application for Android. Below is the code snippet to retrieve latitude and longitude values. public void geoLocation() { locationManager =(LocationManager)getSystemService(Context.LOCATION_SERVICE); locatio ...

Aligning content in the center vertically of a container

My attempt to vertically center some h2 text within a div using display:table-cell along with vertical-align: middle is not successful. The issue seems to be arising because the div I want to center the content in is nested inside another div. Below are ...