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

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

image.png

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

求大佬们解释下?

阅读 1.9k
2 个回答

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

搜索关键字 科学计数法

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题