tkamath99
tkamath99

Reputation: 649

Custom Checkbox Issue in only Edge

I am facing a strange problem with a checkbox that I have customized for my personal blog. I was checking for browser compatibility when I found this scenario.

The custom checkbox is working in Chrome, Firefox and IE 10. But when I checked for Edge, it is not working and the styles are not getting applied.

label {
  display: inline-block;
  max-width: 100%;
}

input[type='checkbox'] {
  display: none;
  box-sizing: border-box;
  padding: 0;
  outline: none;
  border: none;
  background: transparent;
  width: auto;
}

input[type='checkbox']:checked+.tick_mark {
  color: #16a0de;
}

input[type='checkbox']+span {
  cursor: pointer;
  font-weight: normal;
  font-size: 11px;
}

.tick_mark {
  border: 1px solid #666;
  padding: 0px 1px;
  color: white;
  margin: 6px 4px 6px 0;
  font-weight: normal;
}
<label>
  <input name="postSelected" class="NonUnSaved" id="chkBlog" type="checkbox" value="4">
  <span class="tick_mark">&#10004;</span>
  <span class="btntooltip" data-val="checkboxTest">Text 1</span>
</label>

Upvotes: 0

Views: 184

Answers (1)

Hidden Hobbes
Hidden Hobbes

Reputation: 14173

Why this is happening

Edge is defaulting to the Segoe UI Emoji font for the emoji instead of Segoe UI Symbol.

How to fix it

To get a consistent result add font-family: Segoe UI Symbol; to .tick_mark.

label {
  display: inline-block;
  max-width: 100%;
}

input[type='checkbox'] {
  display: none;
  box-sizing: border-box;
  padding: 0;
  outline: none;
  border: none;
  background: transparent;
  width: auto;
}

input[type='checkbox']:checked+.tick_mark {
  color: #16a0de;
}

input[type='checkbox']+span {
  cursor: pointer;
  font-weight: normal;
  font-size: 11px;
}

.tick_mark {
  border: 1px solid #666;
  color: white;
  margin: 6px 4px 6px 0;
  font-weight: normal;
  font-family: Segoe UI Symbol;
  line-height: 1em;
  min-width: 1em;
  min-height: 1em;
  display: inline-block;
  text-align: center;
}
<label>
  <input name="postSelected" class="NonUnSaved" id="chkBlog" type="checkbox" value="4">
  <span class="tick_mark">&#10004;</span>
  <span class="btntooltip" data-val="checkboxTest">Text 1</span>
</label>

Upvotes: 2

Related Questions