html - 表头中同一行的 div

标签 html css

以下代码可以在 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/

相关文章:

带有变换旋转(90 度)的 html div 元素在 chrome 中消失

html - * { margin :0; padding:0;} affect HTML?

导航栏中的 html/css 下拉列表没有出现

html - 带有 HTML 和 CSS 的代码元素破坏了我在 Shopware 中的购物世界

javascript - Css float 内部 div 溢出

html - 如何为图像的 css 边框分配动态颜色?

html - 如何删除我的html页面两边的白边

php - 同一域中的多个网站

html - 使用 CSS 将字体大小设置为每个等宽字符正好为 x/window.width

CSS 动画在 Firefox 中不起作用?