I want to design a group of Radio buttons which should look the same in Chrome, Firefox and IE 11. My solution looks pretty fine in Firefox. In Chrome there is a blue box round the buttons and in IE 11 it seems, that the color and border is not recognized. That is how it should look like.
Taht is how it looks in Chrome
and that is it how it looks like in IE 11
This is my Code, HTML
.radiobuttons{
background-color: white;
font: 16px Arial, sans-serif;
}
.radiolabel{
font: 16px Arial, sans-serif;
color: #000000;
opacity: 0.9;
}
.radiobtn[type="radio"] {
/* remove standard background appearance */
-webkit-appearance: none;
-moz-appearance: none;
/* create custom radiobutton appearance */
display: inline-block;
width: 25px;
height: 25px;
padding: 4px;
/* background-color only for content */
background-clip: content-box;
border: 2px solid #000000;
opacity: 0.4;
border-radius: 50%;
vertical-align: bottom;
}
/* appearance for checked radiobutton */
.radiobtn[type="radio"]:checked {
background-color: green;
border: 2px solid green;
opacity: 1;
}
.radiogroup {
vertical-align: middle;
margin-bottom: 20px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Title</title>
<link rel = "stylesheet" href = "test.css">
</head>
<body>
<div class="radiobuttons">
<div class="radiogroup">
<input class="radiobtn" type="radio" id="mc" name="Zahlmethode" value="Mastercard" >
<label class="radiolabel" for="mc"> Mastercard</label><br>
</div>
<div class="radiogroup">
<input class="radiobtn" type="radio" id="vi" name="Zahlmethode" value="Visa">
<label class="radiolabel" for="vi"> Visa</label><br>
</div>
<div class="radiogroup">
<input class="radiobtn" type="radio" id="ae" name="Zahlmethode" value="AmericanExpress">
<label class="radiolabel" for="ae"> American Express</label>
</div>
</div>
</body>
How can achieve to get the same design for all browser?
For Chrome/Opera you can just add
to remove that blue box around checkbox. In case of IE 11 this can be the solution:
Add this for IE11, used
::-ms-check
Also if you want the outline as well add
This is not cross-browser compatible plus it's not good to use vendor prefixes for the long run, especially the below code:
Instead, you may want to use a font icon replacement or a normal SVG icon background for a
<span>
or similar element this way:Browser Compatibility
I wrote this snippet just for this answer. This solution is perfectly cross browser compatible between any of the following browsers:
Preview