当溢出发生时,将图片放入具有水平滚动的表格单元格中

时间:2015-09-14 19:49:13

标签: html css image html-table overflow

我有以下html表片段:

<td>
<div>

    <a class="fancy_image" href="/owner/createCompany/getOriginalImage/3" title=""><img class="image-lis-in-table-cell" src="/owner/createCompany/getMediumThumbnail/3" alt=""></a>

    <a class="fancy_image" href="/owner/createCompany/getOriginalImage/1" title=""><img class="image-lis-in-table-cell" src="/owner/createCompany/getMediumThumbnail/1" alt=""></a>

    <a class="fancy_image" href="/owner/createCompany/getOriginalImage/5" title=""><img class="image-lis-in-table-cell" src="/owner/createCompany/getMediumThumbnail/5" alt=""></a>

    <a class="fancy_image" href="/owner/createCompany/getOriginalImage/2" title=""><img class="image-lis-in-table-cell" src="/owner/createCompany/getMediumThumbnail/2" alt=""></a>

    <a class="fancy_image" href="/owner/createCompany/getOriginalImage/4" title=""><img class="image-lis-in-table-cell" src="/owner/createCompany/getMediumThumbnail/4" alt=""></a>

</div>
</td>

它看起来像这样:

enter image description here

当我在表格单元格tr中有超过2张图片时,会发生变化。它看起来很难看。我希望这些图片只在一行内呈现,如果有太多图片,我想看到滚动。

可以为我的愿望提供风格。

1 个答案:

答案 0 :(得分:0)

.image-lis-in-table-cell {
       margin: auto;
       white-space: nowrap;
       width: 100%;
       overflow:auto; }

如果你需要更多,那么你可以使用任何一个       overflow-x:scrolloverflow-y:scroll;