E
E
EvgMul2016-07-08 00:36:07
css
EvgMul, 2016-07-08 00:36:07

Why is the em() function not working in sass?

Hello, I write a line like this:
font-size: em(20px)
I get the same output. Tell me what I'm doing wrong or maybe something is not connected?
Otherwise, sass works, the code compiles.
Thanks in advance to all who respond

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
zooks, 2016-07-08
@EvgMul

Because you need to write a mixin:

$browser-context: 16; // Default

@function em($pixels, $context: $browser-context) {
  @return #{$pixels/$context}em;
}

Call without specifying px for pixels.

S
sim3x, 2016-07-08
@sim3x

sass doesn't have built-in function em
em was good to use for IE6-7

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question