显示:initial在非CSS3浏览器会发生什么? [英] What happens with display:initial on non CSS3 browsers?

查看:94
本文介绍了显示:initial在非CSS3浏览器会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道在非CSS3兼容的浏览器上使用 display:initial 时,将设置什么值/ css?

I need to know what value/ css would be set when I use display: initial on non CSS3 compliant browsers ?

我隐藏类使用 display:none &需要显示回来,我打算使用 display:initial (我不想使用 display:block if以前它是 display:inline ),但隐藏的元素必须在所有浏览器上显示。

I'm hiding the class using display:none & need to show back, for which I intend to use display: initial (I dont want to use display:block if previously it was display:inline) but the hidden element must be shown on all browsers.

推荐答案

CSS 2.1会发生什么错误处理规则 以及在实践中是声明 display:initial 被忽略,而不影响样式表的其余部分。 display 属性因此从其他规则获得其值。如果在任何样式表(包括浏览器默认样式表)中没有任何设置,则会使用 inline 的初始值。

What happens by CSS 2.1 rules on error handling as well as in practice is that the declaration display: initial is ignored, without affecting the rest of the style sheet. The display property thus gets its value from other rules. In the absence of any setting on it in any style sheet (including browser default style sheet), the initial value inline is used.

编辑问题时的后备代码意味着 display 的值为在其他浏览器中支持值 inline 的浏览器中的inline 这听起来不安全。

The "fallback" code in the edit of your question means that the value of display would be inline in browsers that support the value inline, and block in other browsers. This does not sound safe.

初始 不是意味着在样式表中设置的上一个值问题似乎假设。相反,它意味着在CSS规范中被指定为属性的初始值的值。对于显示,这是 inline

The value initial does not mean "the previous value set in a style sheet" or anything like that, as the question seems to postulate. Instead, it means the value that is designated as the property’s initial value in CSS specifications. For display, this is inline.

这篇关于显示:initial在非CSS3浏览器会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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