I am using that simple CSS in an Android WebView.
.rounded{
text-align: center;
border-radius: 25px;
border: 2px solid #FFFF014F;
}
It is working totally OK with an API 28 device. But with a 22 API device I am not getting the same result (The border is not being shown at all).
These are the two devices I am using (Both devices have the same resolution):
I suppose the css properties are being interpreted different depeding on the WebView or API version. (I am not sure about that)
I would like to have one single css file working the same way all over the Android versions. So:
Use rgba()
color notation.
It's supported better than HEX rgba.
Let's convert #FFFF014F
:
Red: FF = 255
Green: FF = 255
Blue: 01 = 1
Alpha: 4F = 79/255 = .31
So the result is border: 2px solid rgba(255, 255, 1, .31);
body {background:navy}
span {
display:inline-block;
padding:.5em;
margin:1em;
text-align: center;
border-radius: 25px;
color:#fff;
}
.hex {border: 2px solid #FFFF014F}
.rgba {border: 2px solid rgba(255, 255, 1, .31)}
<span class="hex">#FFFF014F</span>
<span class="rgba">rgba(255, 255, 1, .31)</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With