CSS表达式 [英] CSS Expressions

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

问题描述

我读的地方,CSS表达式已被弃用,甚至不应该使用。我从来没有听说过他们,决定去看看。我发现了一个代码示例,即使您滚动,也会在屏幕上的同一位置保留一个浮动元素。

I read somewhere that CSS Expressions were deprecated and shouldn't even be used. I had never heard of them and decided to take a look. I found a code example that kept a floating element in the same spot on the screen, even if you scrolled.

<html>
<style>
#fixed {
position:absolute;
left:10px;
top:expression(body.scrollTop + 50 + "px");
background:white;
border:1px solid red;}
</style>
<body>
<p id="fixed">Here is some text, which is fixed.</p>
<p>
[many times: "stuff <br/>"]
</p>
</body>
</html>

这让我想起了在网页底部有共享栏

This reminded me of the sites that had the "share bars" and stuff at the bottom of their pages.

所以...


  1. 这是怎么回事?

  2. 如果没有,我应该使用什么?

  3. >


推荐答案

用于在旧的IE的工作,但他们已经完全放弃在IE8:

CSS expressions used to work in older IE's, but they have been completely abandoned in IE8:


Internet Explorer 8及更高版本在IE8标准中不再支持动态属性(也称为CSS表达式)模式和更高。此决定是针对标准合规性,浏览器性能和安全原因,详细信息,请参见标题为结束表达式的IE博客条目。动态属性在IE7模式或IE5模式下仍然可以在Internet Explorer 8中使用。

Dynamic properties (also called "CSS expressions") are no longer supported in Internet Explorer 8 and later, in IE8 Standards mode and higher. This decision was made for standards compliance, browser performance, and security reasons, as detailed in the IE blog entry titled Ending Expressions. Dynamic properties are still available in Internet Explorer 8 in either IE7 mode or IE5 mode.

因此,可以说, 。


如果没有,我应该使用什么?

If not, what should I use?

根据用例,JavaScript或媒体查询

Depending on the use case, JavaScript or media queries.

正如@Yet Another Geek注意到,您的上述示例可以使用 position:fixed 。 IE6不支持 - CSS表达式可能是为了解决这个问题而创建的。

As @Yet Another Geek notes, your above example can be implemented using position: fixed. IE6 doesn't support that - the CSS expression was probably created to work around that.

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

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