表边框间距不起作用

vly*_*dra 7 html css

我正在尝试使用CSS border-spacing属性将此表中的图像与空格分开,但由于某种原因它无法正常工作.您可以在这里看到JSFiddle中图像如何仍然粘在一起:http://jsfiddle.net/nKgnq/

我试图通过在图像周围填充填充来破解它,但无济于事.如何将这些照片分开?

生成表的代码如下:

<div class="table-right">
    <table class="fixed-height fixed-width fixed-cell">
        <tr>
            <td class="valigned"><h3 class="date">Details</h3>
                <?php the_field('details');?>
            </td>
            <td class="valigned">
                <a href="<?php echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image');?>">
                    <img class="detail-image" src="<?php echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image');?>">
                </a>
            </td>
            <td class="valigned">
                <a href="<?php echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'tertiary-image');?>">
                    <img class="detail-image" src="<?php echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'tertiary-image');?>">
                </a>
            </td>
            <td class="valigned">
                <a href="<?php echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'fourth-image');?>">
                    <img class="detail-image" src="<?php echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'fourth-image');?>">
                </a>
            </td>
        </tr>
    </table>
</div>
Run Code Online (Sandbox Code Playgroud)

and*_*wct 12

在你的CSS中,你申请border-spacing:5px了这个table-right课程,但是你的桌子没有使用它,即使它包含在你申请的div中,因为你有

table { /* tables still need 'cellspacing="0"' in the markup */
    border-collapse: separate;
    border-spacing: 0;
}
Run Code Online (Sandbox Code Playgroud)

在你的css中,这是一个更具体的选择器,将覆盖div中继承的css.如果你上课了

.table-spacing{
   border-spacing:5px;
}
Run Code Online (Sandbox Code Playgroud)

你可以将它应用于你的表标签

<table class="fixed-height fixed-width fixed-cell table-spacing">
Run Code Online (Sandbox Code Playgroud)

我认为,这将以所要求的方式解决问题

  • 对我来说,"边界崩溃:分离;"被"边界崩溃:崩溃"所覆盖,最终成为罪魁祸首. (3认同)
  • 所以除非也使用了`border-collapse:separate`,否则`border-spacing`不起作用吗?http://www.w3schools.com/cssref/pr_border-spacing.asp 好像是这么说的 (2认同)