内联CSS元素在表格单元格中溢出

时间:2013-04-03 20:05:06

标签: javascript html css-tables

我创建了一个脚本,可以动态地在表格中插入包含内容的表格行。问题是,我在单元格内使用<span><a>标签来显示多章条目。如果视口太小,而不是破坏新行,元素只会溢出单元格,因此被作者名称覆盖。

Screencap

网站链接:http://hunpony.hu/hunfic/

插入的动态HTML(示例):

<span class="chapter-list">
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/prologus" target="_blank" data-hasqtip="true" oldtitle="Prológus" title="">Pr</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/i" target="_blank" data-hasqtip="true" oldtitle="1. fejezet" title="">1</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/ii" target="_blank" data-hasqtip="true" oldtitle="2. fejezet" title="">2</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/iii" target="_blank" data-hasqtip="true" oldtitle="3. fejezet" title="">3</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/iv" target="_blank" data-hasqtip="true" oldtitle="4. fejezet" title="">4</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/v" target="_blank" data-hasqtip="true" oldtitle="5. fejezet" title="">5</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/vi" target="_blank" data-hasqtip="true" oldtitle="6. fejezet" title="">6</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/vii" target="_blank" data-hasqtip="true" oldtitle="7. fejezet" title="">7</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/viii" target="_blank" data-hasqtip="true" oldtitle="8. fejezet" title="">8</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/epilogus" target="_blank" data-hasqtip="true" oldtitle="Epilógus" title="">Ep</a>
    <a href="https://sites.google.com/site/ponydocs/home/nite/eljonek-az-unnepek/elmulnak-az-unnepek" target="_blank" data-hasqtip="true" oldtitle="Utószó" title="">Usz</a>
</span>

一些CSS规则:

td.title .chapter-list {
    list-style:none;
    padding:0;
    margin:0;
    font-variant: small-caps;
    white-space: nowrap;
    padding-right:0;
}
td.title .chapter-list:before { content: "(fejezetek: "  }
td.title .chapter-list:after { content: ")"  }
td.title .chapter-list a {
    white-space: nowrap;
    margin:0px 3px;
    padding-bottom:0;
}
td.title .chapter-list a:after { content:", " }
td.title .chapter-list a:last-child:after { content: "" !important }

1 个答案:

答案 0 :(得分:2)

我在萤火虫中检查过这个。移除white-space: nowrap;td.title .chapter-list的{​​{1}} 改为添加

td.title .chapter-list a