css - 3 个嵌套 div - 父级固定宽度,基于内容的左右宽度,空中心宽度等于差异?

标签 css html fluid

这可能真的很棘手!

这是我想要实现的:

3 column finella

这是我的 test code在 jsfiddle 上

我尝试过各种方法,但都没有成功。 问题是左右 div 宽度都基于其中的文本宽度。我也不能让连接的虚线位于左右 div 的下方,并且只是用背景颜色掩盖它,因为网站的背景是渐变的。

至少在这种情况下,父 div 是固定的。

有什么想法吗?

最佳答案

我真的很讨厌提供有关使用表格的建议,但是,这将是使用表格/div/css 混合解决方案的最简单方法。经过测试并有效。

<div style="position: relative; width: 300px; height: auto;">
<table style="width: 100%">
  <tr>
    <td style="float: left; width: auto">
        a
    </td>
    <td style="width: 100%; text-align: left;">
        <div style="width: 100%; border-bottom: 1px dotted #fff; height:10px;"> </div>
    </td>
    <td style="float:right">
        z
    </td>
  </tr>
</table>
</div>
<div style="position: relative; width: 300px; height: auto;">
<table style="width: 100%">
  <tr>
    <td style="float: left; width: auto">
        1
    </td>
    <td style="width: 100%; text-align: left;">
        <div style="width: 100%; border-bottom: 1px dotted #fff; height:10px;"> </div>
    </td>
    <td style="float:right">
        infinity
    </td>
  </tr>
</table>
</div>

关于css - 3 个嵌套 div - 父级固定宽度,基于内容的左右宽度,空中心宽度等于差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5326881/

相关文章:

css - 将条件 CSS 选择器应用于 magento 属性

javascript - jQuery 弹出窗口在手机上调整大小

javascript - 限制用户将值放在 html 输入的范围内(类型 = 数字)

templates - TYPO3 流体 : How is it possible to use conditions and variables outside of <f:section> to make the layout dynamic?

fluid - 在 Typo3 的 Controller 操作中获取流体模板的 HTML

css - 是否可以在 CSS 中制作流畅的边框?我正在绘制一个三 Angular 形,我希望它覆盖页面的 50% 宽度和 50% 高度。

css - 改变文字颜色

javascript - 如何使用 java 脚本中的 window.print 方法更改页眉和页脚样式?

Javascript/jQuery 在 Chrome 中完美运行,但在 Firefox 中运行不佳

html - CSS:Scale(x) 使图标旋转