【发布时间】:2012-05-07 10:45:37
【问题描述】:
我想在我的页面上有一个div,它居中并具有一定的宽度,但如果内容需要,它会超出该宽度。我正在这样做:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
.container-center {
text-align: center;
}
.container-minwidth {
min-width: 5em;
display: inline-block;
border: 1px solid blue;
}
</style>
</head>
<body>
<div class="container-center">
<div class="container-minwidth">
a
</div>
</div>
</body>
</html>
这在 Firefox/Safari 上很有效,但在 IE6 上却不行,因为它不理解 display: inline-block。关于如何在 IE6 上也能进行这项工作的任何建议?
【问题讨论】:
-
IMO 应该让它在 IE6 上看起来很糟糕。