Reputation: 177
I face a problem with checkbox
in IE and Edge, namely a "content" class. I have the following code:
<input id="checkbox" type="checkbox" class="checkbox-edit-article" name="breakingNews" ng-model="showPublished" ng-change="updateCategory(selectedCategory, pageID)">
<label for="checkbox" class="checkbox-edit-article-label">
Show only published articles
</label>
</input>
When field is checked
.checkbox-edit-article:checked + .checkbox-edit-article-label:before {
content: url(../img/mark-white.png);
background: rgb(49,119,61);
color: #fff;
height: 44px;
line-height: 2.4;
transition: all .2s;
}
and static
.checkbox-edit-article + .checkbox-edit-article-label:before {
content: '';
background: #fff;
border: 1px solid #BFBFBF;
display: inline-block;
vertical-align: middle;
width: 43px;
height: 44px;
margin-right: 10px;
margin-top: 1px;
text-align: center;
box-shadow: inset 0px 0px 0px 1px white;
}
In Chrome content: url(../img/mark-white.png);
is displayed perfectly, but in IE this check image is too high because of line-height
, but I don't know how to center the picture in the checkbox.
I ask your help, how I can align the image?
Thank you in advance!
Upvotes: 1
Views: 1292
Reputation: 87191
You put your image in background
instead, like this
background: rgb(49,119,61) url(../img/mark-white.png) no-repeat center center;
Sample snippet
.checkbox-edit-article:checked + .checkbox-edit-article-label:before {
content: '';
background: rgb(49,119,61) url(https://i.sstatic.net/NOQI7.png) no-repeat center center;
background-size: 25px 25px; /* this I just added to make my bigger mark be small */
color: #fff;
height: 44px;
transition: all .2s;
}
.checkbox-edit-article + .checkbox-edit-article-label:before {
content: '';
background: #fff;
border: 1px solid #BFBFBF;
display: inline-block;
vertical-align: middle;
width: 43px;
height: 44px;
margin-right: 10px;
margin-top: 1px;
text-align: center;
box-shadow: inset 0px 0px 0px 1px white;
}
<input id="checkbox" type="checkbox" class="checkbox-edit-article" name="breakingNews" ng-model="showPublished" ng-change="updateCategory(selectedCategory, pageID)">
<label for="checkbox" class="checkbox-edit-article-label">Show only published articles</label>
Upvotes: 1