下面的代码实现了在Internet Explorer的同一行上显示两个div的功能:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style>
th
{
border: 0px solid;
font :12px/1.3 "Lucida Grande", Arial, sans-serifw;
font-weight: bold;
padding-left: 5px;
padding-right: 5px;
background :lightgrey;
clear :both;
width: 70px;
}
.thspan
{ display: inline;
float :left;
word-wrap: break-word;
margin-right 25px;
}
.bspan
{ display: inline;
float: right;
width: auto;
}
</style>
</head>
<body>
<table>
<th>
<div class="bspan"><button id="text2"></button></div>
<div class="thspan">text1dskjsdkjfsd-sdfdsf</div>
</th>
</table>
</body>
</html>
但现在它在Chrome和Firefox中不起作用。有人知道为什么吗?
谢谢
发布于 2012-02-03 21:44:00
尝试更改。此跨度位于下面
添加右边距,去掉浮动并将显示更改为块
.thspan {
display: block;
word-wrap: break-word;
margin-right: 20px;
}
发布于 2012-02-03 20:35:10
我想只是你的“th”不够宽,试试这个:
th{
width: 160px;
}
发布于 2012-02-03 20:35:37
尝试对DIVs使用display : inline-table
https://stackoverflow.com/questions/9128713
复制相似问题