2013-04-03 94 views
0

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

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

你的风格'白色空间:NOWRAP;'力线不换行,这是造成你的溢出。 – 2013-04-03 20:12:47

回答

2

我检查了这一点萤火虫。为td.title .chapter-list删除white-space: nowrap;td.title .chapter-list a 添加这个代替

td.title .chapter-list, 
td.title .chapter-list a 
{ 
white-space: normal; 
} 
+0

其实,删除'white-space'规则完全解决了这个问题,谢谢! – SeinopSys 2013-04-03 20:15:02

+0

出于好奇,为什么你需要添加'空白:正常;'如果你删除'nowrap'属性?它应该默认为正常,如果你删除它的权利? – 2013-04-03 20:15:11

+0

你是对的@TracyFu,我只是担心万一它继承了其他类的一些规则。 – trajce 2013-04-03 20:16:50