CSS3 样式属性中的布尔值
在 CSS3 中,是否有任何属性采用 false
或 null
值?我想并期望不会,但想确定一下。
我正在编写一段 javascript 代码(与 ajax 交互相关),用于设置或删除某个 DOM 对象的属性。该函数采用属性名称及其值作为参数,我想,如果该值结果为 false
或 null
,则 removeAttribute( )
函数应该被调用,否则,应该为该属性分配该值。如果有一个样式属性可能采用 false
或 null
值,那么我不能这样做,所以我想确定一下。
In CSS3, is there any attribute that takes false
or null
value? I suppose and expect not, but wanted to make sure.
I am writing a javascript code (related to ajax interaction) that sets or removes an attribute to/from some DOM object. The function takes an attribute name and its value as the arguments, and I am thinking that, if the value turns out to be false
or null
, then removeAttribute()
function should be called, and otherwise, the attribute should be assigned with that value. If there is a style attribute that possibly takes false
or null
value, then I cannot do that, so I wanted to make sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,没有任何属性采用
false
或null
。但是,我非常确定您可以在没有任何视觉影响的情况下创建您的财产。No, there is no attribute that takes
false
ornull
. However, I am pretty sure you can create your property without any visual impact.不会。即使像
speak-header
这样的内容也只有两个可能的值仍然可以接受特殊值inherit
。No. Even ones like
speak-header
which have only two possible values can still accept the special valueinherit
.