Android How to load Custom CSS on external HTML page in WebView

Tags: android,css

Problem :

I want to apply my custom CSS on HTML page i tried this way but it is not working.

 wv.loadUrl("<style>.featured {"+
        "   background-image: -ms-linear-gradient(bottom, #F9F6F9 0%, #ECE4F4 100%);"+
        "   background-image: -moz-linear-gradient(bottom, #F9F6F9 0%, #ECE4F4 100%);"+
        "   background-image: -o-linear-gradient(bottom, #F9F6F9 0%, #ECE4F4 100%);"+
        "background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #F9F6F9), color-stop(1, #ECE4F4));"+
        "   background-image: -webkit-linear-gradient(bottom, #F9F6F9 0%, #ECE4F4 100%);"+
        "   background-image: linear-gradient(to top, #F9F6F9 0%, #ECE4F4 100%);"+

please help me out.

Solution :

Thank you for your answers guys but i got my solution.

This my solution.

wv.loadUrl("javascript:(function() { " +                        
    "var divs = document.getElementsByClassName('free');"+
     "for(var i=0; i<divs.length; i++)"+
        "divs[i].style.backgroundImage='-webkit-gradient(linear, left bottom, left top, color-stop(0, #FFFFFF), color-stop(1, #EFD2E4))';"+

using this you can apply your custom CSS on any Tag or Elements of the HTML in Android.

    CSS Howto..

    How to resize a canvas without anti-aliasing?

    How to design a CSS for a centered floating confirm dialog?

    How to make my popup window dead center no matter what width it is

    How to place the same image at the top and at the bottom of the same column?

    How to show Div after a Specific time of page load?

    Sidebar, Navigation and Content how to do it?

    How do you create an arrow for sub navigation like this?

    How to link a main.css to all Django templates? [closed]

    How to get text within div to be relative to the div's width and height, CSS, HTML

    How to create dashed radius border just with css?

    How to horizontally center a link element with CSS?

    How to display visual rows and cols in textarea using css

    How to make a line in a table with CSS

    How to make a Sass mixin declare a non-nested selector on base level?

    How to do jasmine test case for display none css property using documet.getElementById and getElementsByClassName

    how to overwrite button's non-hover state colour to grey, but when hover button show the colour (with css framework)

    how to select a input using jquery

    How to apply CSS locally on any online page?

    How to horizontally center-align the content of a div by manipulating the CSS of the wrapper div only?

    How to change css class according to the name attribute of a parent

    CSS- How to align background image over bottom border line? Jsfiddle included

    How to align a table menu to an Banner

    How to stop css inheritance in sub unorder list

    How to create a horizontal navigation in HTML/CSS above an image?

    Background Image in WebView showing in Simulator, but not on Device

    How to capture extra css class in addition to the pseduo class in this less (css) code?

    Show DIV on hover of other DIV that is not parent with CSS or JS [duplicate]

    How to stop CSS element style from getting into my class style?

    How to hide currently selected li item from being an option when user clicks dropdown again?

    HTML/CSS buttons don't show in IE properly