Android Question How to change button color in a webview HTML code


Active Member
Licensed User
Longtime User
button01.png button02.png I am using a webview with a button ,and want to change the buttoncolor when pressed.
When I test this html file in firefox , the buttoncolor changes in red when pressed.
With a WebView ,the buttoncolor stays blue ,it should be red when pressed (knop-class),
the center class is ok.

I don't think this is something in B4a but maybe someone has a clue.

The html code is :

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

.knop {
    font-family: Calibri, sans-serif;
    font-weight: bold;
    width: 160px;
    height: 25px;
    color: white

.knop:active {
   color: white;

.center {
    text-align: center;
    color: red;
<body style="border: 2mm solid rgb(238, 232, 170); background-color: white;float:left;">

<p class="center">Red and center</p> <br> <br>
<input type="button" class="knop" value="Geluid" />
<br> <br> <br> <br> <br> <br>


button02.png button02.png


Active Member
Licensed User
Longtime User
Thanks for this link Erel , a solution they mentioned

just add empty touchstart event to the body tag:

works,now the button color changes to red also with WebView.
Upvote 0