S
S
sunny-plum2019-06-07 03:26:23
css
sunny-plum, 2019-06-07 03:26:23

Em units in IE11 are not displayed correctly when setting font-size on a :before element, how to fix other than setting it to px?

Units emin IE11 are not displayed correctly, in the task font-sizein the element :before, how to fix it, except for setting a fixed size in px?
They are much smaller.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2019-06-07
@sunny-plum

Honestly, I don't know what's wrong with IE.
But in any case, IE11 is no longer worth the extra effort.
Do this for example:

.element::before {
  --this-font-size: 2em;
  font-size: 36px; // Для ишака
  font-size: var(--this-font-size);// Для нормальных браузеров
}

IE doesn't understand variables, so it uses the pixel definition.
PS
You can not define a variable, for brevity, and use the default parameter:
.element::before {
  font-size: 36px; // Для ишака
  font-size: var(--fz, 2em);// Для нормальных браузеров
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question