哪些浏览器仍然支持CSS表达式 [英] Which browsers still support CSS expressions

查看:123
本文介绍了哪些浏览器仍然支持CSS表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从博客:


使用CSS表达式的基本思想是
,你将有计算和

CSS代码中的属性的动态值,人们有
的东西发现非常有用。一个简单的例子
可以在IE 6中实现最大宽度行为



width:
expression(document.body.clientWidth >
1100)? 1100px:auto;


这是我第一次阅读。看来IE用于支持CSS表达式,但把它们丢弃在IE8。什么其他浏览器仍在使用它们,它们通常是好的还是坏的?



博客文章我得到这个来自说替代是Javascript,但我认为CSS更支持,因此比Javascript更好。

解决方案

AFAIK,只有IE6 / 7
$ b

我从来没有想过他们是一件好事。



它们实际上是用JavaScript实现的,我非常确定禁用JS会禁用这些表达式。



您发布的示例...

  width:expression(document.body.clientWidth& 1100)? 1100px:auto; 

...只是一个三元运算符,说如果宽度大于1100px,设置为1100px,否则将属性设置为自动。



为了完成,Web上没有脚本语言支持比JavaScript更广泛。 b $ b

From a blog:

The basic idea with CSS expressions is that you will have calculation and dynamic values for properties in the CSS code, something that people have found very useful. A simple example can be implementing max-width behavior in IE 6:

width: expression(document.body.clientWidth > 1100)? "1100px" : "auto";

This is the first time I read about them. It seems IE used to support CSS expressions but dropped them in IE8. What other browsers still use them and are they generally a good or bad thing?

The blog post I got this from says the alternative is Javascript, but I thought CSS was more supported and therefore better than Javascript.

解决方案

AFAIK, it was only ever IE6/7 (maybe) 5.

I never thought they were a good thing. May as well just use JavaScript directly.

They are in fact implemented in JavaScript, and I'm pretty sure disabling JS disables these expressions.

The sample you posted...

width: expression(document.body.clientWidth >  1100)? "1100px" : "auto";

...is just a ternary operator that says If the width is larger than 1100px, set it 1100px, otherwise set property to auto.

To finish, no scripting language on the web is more widely supported than JavaScript.

这篇关于哪些浏览器仍然支持CSS表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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