Custom checkboxes don't display correctly on IE11 and Firefox

好久不见. 提交于 2019-12-24 01:01:30

问题


I made these custom checkboxes, they are green when they are checked and gray when they aren't :

input[type=checkbox]{
	width: 20px; height: 20px;
	margin: 0 3px;
	display: inline-block;
	position: relative;
}

input[type=checkbox]:checked:before{
	background-color: #219741;
	display: inline-block;
	width: 100%; height: 100%;
	border: 0;
}

input[type=checkbox]:checked:after{
	content: "";
}

input[type=checkbox]:not(:checked):before{
	background-color: #ddd;
	display: inline-block;
	width: 100%; height: 100%;
	border: 0;
}

input[type=checkbox]:not(:checked):after{

}


.reserv-vehicule:checked:before{content: url('');}
.reserv-vehicule:not(:checked):before{content: url('');}
<div class="checkboxes">
  
  <input type="checkbox" class="reserv-vehicule" checked="checked">
  <input type="checkbox" class="reserv-vehicule" checked="checked">
  <input type="checkbox" class="reserv-vehicule" checked="checked">
  <input type="checkbox" class="reserv-vehicule" checked="checked">
  <input type="checkbox" class="reserv-vehicule">

</div>

It works fine on Chrome, but my checkboxes aren't displayed correctly on IE11 and Firefox , they still have the default design.

Can someone explain to me why this code doesn't work on these browsers?

On the DOM Explorer I see this (nothing else seems to override these values) :

来源:https://stackoverflow.com/questions/37727220/custom-checkboxes-dont-display-correctly-on-ie11-and-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!