IE上的最小宽度的内联跨度 [英] Inline span with min-width on IE
问题描述
您好,我有3 SPAN
必须 inline
,并且有 min-width
。
明显在IE上, SPAN
不能有
。我尝试使用 DIV
但是当我把它 inline
时, min-width
是忽略。
Hi
I have 3 SPAN
that must be inline
and have and a min-width
.
Apparently on IE, the SPAN
can't have an min-width
. I try to use DIV
but when I put it inline
, the min-width
is ignore.
CSS
span {
display: inline;
min-width: 150px;
}
HTML
<span>1</span>
<span>2</span>
<span>3</span>
推荐答案
inline
元素不能采用 width
, height
,垂直边距
& padding
。所以你必须定义 display:inline-block;
这样写:
inline
element can't take width
, height
, vertical margin
& padding
. So you have to define display:inline-block;
write like this:
span {
display: inline-block;
*display: inline;/* for IE7*/
*zoom:1;/* for IE7*/
min-width: 150px;
}
资料来源:层叠样式表第2级修订版1(CSS 2.1)规格:10.3计算宽度和边距:10.3.1内联,未替换的元素:
'width'属性不适用。 margin-left或margin-right的auto的计算值变为使用值0。
The 'width' property does not apply. A computed value of 'auto' for 'margin-left' or 'margin-right' becomes a used value of '0'.
请检查此 http:// jsfiddle。 net / yCvhB / 5 /
这篇关于IE上的最小宽度的内联跨度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!