如何获得“位置:固定” css在IE 7+与TRANSITIONAL doctype工作? [英] How to get "position:fixed" css to work in IE 7+ with TRANSITIONAL doctype?

查看:125
本文介绍了如何获得“位置:固定” css在IE 7+与TRANSITIONAL doctype工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在IE 7之前IE不支持 position:fixed; ,如果你有一个 STRICT DOCTYPE



我的问题是:如何使用 TRANSITIONAL DOCTYPE >

请不要建议更改 DOCTYPE ,因为这没有回答我的问题,谢谢。

解决方案

固定支持不需要严格的DOCTYPE。您只需要一个DOCTYPE触发标准模式(或几乎标准)。这可以是一个过渡的doctype,如:

 <!DOCTYPE HTML PUBLIC -  // W3C // DTD HTML 4.01 Transitional // ENhttp://www.w3.org/TR/html4/loose.dtd\"> 

或XHTML:

 <!DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >只要包含系统ID(结尾处的URI),就可以使用



如果您的网页真的依赖Quirks模式(ugh!),对不起,但您不能使用固定,并且必须诉诸JavaScript hacks(但是你可能需要那些为IE6反正)。


I know that position:fixed; was not supported by IE until IE 7, and it only works in IE 7 if you have a STRICT DOCTYPE.

My question is: "How do I get it work with IE 7 with TRANSITIONAL DOCTYPE?"

Please don't suggest changing a DOCTYPE, as this does not answer my question, thank you.

解决方案

You don't need a Strict DOCTYPE for fixed support. You only need a DOCTYPE that triggers Standards Mode (or ‘almost standards’). That can be a transitional doctype such as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

or XHTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

as long as the system ID (the URI at the end) is included.

If your pages really are relying on Quirks Mode (ugh!), I'm sorry but you cannot use fixed and will have to resort to JavaScript hacks (but then you might need those for IE6 anyway).

这篇关于如何获得“位置:固定” css在IE 7+与TRANSITIONAL doctype工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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