以下代码可以在 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 中不起作用...有人知道为什么吗?
谢谢
最佳答案
尝试改变 . thspan 位于下方
添加 margin-right,去掉 float 并将显示更改为 block
.thspan {
display: block;
word-wrap: break-word;
margin-right: 20px;
}
关于html - 表头中同一行的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9128713/