Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.8k views
in Technique[技术] by (71.8m points)

CSS这种写法 height: 5.00004e+06px; 中,应该怎么理解?哪里有文档可以参考呢?

ant.design的虚拟列表发现了这样的属性值,很震惊。

image.png

css的单位中没有见过e这种的,而且计算的话要用calc,但这里居然直接就+拼接了,刷新了我的认知

求大佬们解释下?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

css number

When written literally, a number is either an integer, or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits and optionally an exponent composed of "e" or "E" and an integer. It corresponds to the <number-token> production in the CSS Syntax Module [[CSS-SYNTAX-3]](https://drafts.csswg.org/css-... As with integers, the first character of a number may be immediately preceded by - or + to indicate the number’s sign.

5.00004e+06 就是 5.00004 x 10^6 = 5000040


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...