使用calc和rem和px时解析错误 [英] Parse errors when using calc with rem and px

查看:130
本文介绍了使用calc和rem和px时解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下CSS:

body {
  width: calc(700px + 2 * 4rem);
}

.someclass {
  margin: calc(2rem - 2px) 0;
}



当通过W3C CSS验证运行时,

When I run this through the W3C CSS validation, I get


值错误:width解析错误+ 2 * 4rem)

值错误:margin解析错误 - 2px)0

Value Error : width Parse Error + 2 * 4rem)
Value Error : margin Parse Error - 2px) 0

这是什么原因?我在 calc()中使用的所有单位都是长度单位, calc()应该能够处理

What’s causing this? All the units I’m using in calc() are length units, and calc() should be able to handle it.

推荐答案

这是w3 css验证程序中的已知错误:

This is a known bug in w3 css validator:

https://www.w3.org/Bugs/Public/show_bug.cgi?id= 18913

这篇关于使用calc和rem和px时解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆