我们能否将这些div集中在"IE7及更高版本"中?水平可变宽度而不使用行内块? [英] Can we center those divs "IE7 and up" with variable width horizontally without using inline-block?
本文介绍了我们能否将这些div集中在"IE7及更高版本"中?水平可变宽度而不使用行内块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
没有:
- 在此处添加任何标记元素;
- 不使用
display: inline-block;
- 不知道div宽度;
- 没有黑客.该代码应验证.
- adding any markup element there;
- without using
display: inline-block;
- without knowing the div width;
- no hacks. the code should validate.
如何将这三个div水平居中,但如何使其成为 INLINE ?
How can we center those three divs horizontally, but making them INLINE ?
请注意:
我避免使用inline-block
的原因在于IE7应该表现出来.
在IE 7上不起作用的其他规则也应该被忽略.
Please note:
The reason that I'm avoiding inline-block
, lies on the fact that IE7 should behave.
Other rules that don't work on IE 7 should also be disregarded.
有可能吗?
推荐答案
类似于此- http://jsfiddle. net/mMPMh/10/
还是这个- http://jsfiddle.net/mMPMh/14/? 这与IE7兼容
Or this - http://jsfiddle.net/mMPMh/14/ ? This one works with IE7
对于黑客来说,可以使用条件语句(如
As for hacks, it can be served using conditional statement like
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="ie7-and-down.css" />
<![endif]-->
或在HTML上使用此代码(来自HTML5BP)
Or using this on your HTML (from HTML5BP)
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
并提供如下样式:
.lt-ie8 #one,
.lt-ie8 #two,
.lt-ie8 #three {
display:inline;
zoom:1;
}
没有黑客入侵
这篇关于我们能否将这些div集中在"IE7及更高版本"中?水平可变宽度而不使用行内块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文