DEV Community

Cover image for Trivia: The letter "e" is special. 🧙‍♂️
Adam Crockett 🌀
Adam Crockett 🌀

Posted on

Trivia: The letter "e" is special. 🧙‍♂️

So you think you know all the CSS values and that only numbers are well.. numbers.

Well what if I told you that there is one number or should I say letter that you can enter in a number field and use in CSS values you would not expect. e is a trend setter because in CSS you can do this:

z-index: 9e9;
Enter fullscreen mode Exit fullscreen mode

Interesting no?

In html this will also work:

<input type='number' value='e'/>
Enter fullscreen mode Exit fullscreen mode

Okay so before I explain.. I was once presented with a feedback form asking me to rate my experience between 1 and 10, I didn't think much of the form so I entered e, I'm not sure what the SQL database behind this thought of my helpful data, but there you go, you can't rely on client side validation.

Okay what is e all about? E or exponent is equivalent to pow() or power of. In my CSS example this notation gives a huge number 9 times 10 to the power of 9 (edit) and certainly larger than 9999px, so if you want to write less for your money's worth, e is the way to go.

Html number fields also count e as a number when no other letter will actually be typeable.

So that's e, a computed notation worth knowing.

Top comments (5)

Collapse
 
gypsydave5 profile image
David Wickes • Edited

this notation gives a huge number 9 to the power of 9

Not quite. 9e9 is "9 times 10 to the power of 9". It's a way of expressing a number inscientific notation.

Although I'll admit I'm blown-away-surprised that it's accepted in CSS!

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

IL take that correction and edit it and you take the knowledge that you can win an z-index battle (not that anyone should be in that position)

Collapse
 
jamonjamon profile image
Jaimie Carter

I'm confused... Isn't e 2.8ish? As in e the number the constant.....

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Yes it is also that, but it is also this.

Collapse
 
jamonjamon profile image
Jaimie Carter

Oh wow. Ok.