css - 如何填充表格单元格的整个水平空间?

标签 css html

我试图在我的 table 上制作这些 div 以填充单元格的整个空间,即使没有足够的内容也是如此。

如果您在下面看到,第一个单元格 (data_cell1_lt) 没有完全水平填充文本,因此它使苹果图像 (data_cell3_lt) 向左移动。

接下来的两行文本和图像完美地排列在一起,但这只是因为有足够的文本来填满整个单元格。

http://jsfiddle.net/UMf3k/106/

<div class="wrapper-data">
    <div class="data_row">
        <div class="data_cell1_lt">
            <p>Fill the entire space.</p>
        </div>
        <div class="data_cell2_lt">
            &nbsp;</div>
        <div class="data_cell3_lt">
            <img alt="Apple" src="http://www.clker.com/cliparts/3/m/v/Y/E/V/small-red-apple-th.png" style="width: 96px; height: 99px;" /></div>
    </div>
    <div class="data_row">
        <div class="data_cell1_lt">
            <p>Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.</p>
        </div>
        <div class="data_cell2_lt">
            &nbsp;</div>
        <div class="data_cell3_lt">
            <img alt="Apple" src="http://www.clker.com/cliparts/3/m/v/Y/E/V/small-red-apple-th.png" style="width: 96px; height: 99px;" /></div>
    </div>
    <div class="data_row">
        <div class="data_cell1_lt">
            <p><p>Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.Fill the entire space.</p>
        </div>
        <div class="data_cell2_lt">
            &nbsp;</div>
        <div class="data_cell3_lt">
            <img alt="Apple" src="http://www.clker.com/cliparts/3/m/v/Y/E/V/small-red-apple-th.png" style="width: 96px; height: 99px;" /></div>
    </div>
</div>

最佳答案

你想要像this这样的东西吗? ?

我刚刚在 .data-row 类中添加了 width: 100%;

关于css - 如何填充表格单元格的整个水平空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20690566/

相关文章:

javascript - 发布前的 ajax 条件变量

javascript - "Uncaught RefereceError: txtfile is not defined"

jQuery 扩展列表项在 IE7 中显示略有不同

java - 使用 GWT 重复发布帖子

html - 将鼠标悬停在内容上时,IE7 鼠标悬停导航 block 消失

javascript - 如何使用 javascript 验证我的表单

css - 菜单展开时加号标志不变

javascript - 旋转 css 3d 对象不能正常工作

html - 为什么我的 div 不能全部水平对齐?

javascript - 优化完全相同的 iframe 的加载