- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
请参阅 JS Fiddle 我期望其中的描述实际上隐藏了溢出的内容并仅显示分配的宽度百分比的文本。(在本例中为 17%)。我正在使用 Bootstrap 3.3.7 版本进行 CSS 样式设置。我不确定是什么导致了这个问题。
谁能帮我解决这个问题?
<table class="table table-hover table-striped mytable" rules="all" id="gvTimeEntries" style="border-collapse:collapse;" cellspacing="0" border="1">
<thead>
<tr style="color:White;background-color:#00A4E4;font-weight:bold;">
<th class="overflowHidden" scope="col" style="width:17%;">Project</th>
<th class="overflowHidden" scope="col" style="width:17%;">Sub-Project</th>
<th class="overflowHidden" scope="col" style="width:17%;">Task</th>
<th class="overflowHidden" scope="col" style="width:17%;">Description</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Mon</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Tue</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Wed</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Thu</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Fri</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Sat</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Sun</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblProject" title="Rater Onboarding & Support" style="display:inline-block;width:100%;">Maecenas elit ex, feugiat vel fermentum n</span>
</div>
</td>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblSubProject" title="Rater Onboarding and Version Release " style="display:inline-block;width:100%;">consectetur adipiscing elit. Phasellus </span>
</div>
</td>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblTask" title="Design & Development" style="display:inline-block;width:100%;">Sample</span>
</div>
</td>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblComment" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultrices ligula ut posuere ultrices. Ut facilisis mauris tortor, vitae molestie lorem bibendum eget. Etiam vehicula maximus dui et auctor. Morbi eget pulvinar sapien. Vivamus mi lorem, congue id porta in, interdum vitae lectus. Fusce id viverra justo, quis finibus metus. Ut feugiat consequat metus at volutpat. Phasellus mi leo, vulputate id tortor eu, accumsan eleifend lectus. Nam lobortis feugiat ligula, eget iaculis risus tristique et. Cras at nunc orci. Sed volutpat magna vel nunc dignissim sodales. Maecenas elit ex, feugiat vel fermentum nec, sollicitudin sit amet dui. Etiam dapibus, lacus non facilisis ullamcorper, quam arcu tempus risus, nec porta orci purus vel lectus. Maecenas nec molestie nisl. Sed id velit ac sapien finibus blandit. In non sed.">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultrices ligula ut posuere ultrices. Ut facilisis mauris tortor, vitae molestie lorem bibendum eget. Etiam vehicula maximus dui et auctor. Morbi eget pulvinar sapien. Vivamus mi lorem, congue id porta in, interdum vitae lectus. Fusce id viverra justo, quis finibus metus. Ut feugiat consequat metus at volutpat. Phasellus mi leo, vulputate id tortor eu, accumsan eleifend lectus. Nam lobortis feugiat ligula, eget iaculis risus tristique et. Cras at nunc orci. Sed volutpat magna vel nunc dignissim sodales. Maecenas elit ex, feugiat vel fermentum nec, sollicitudin sit amet dui. Etiam dapibus, lacus non facilisis ullamcorper, quam arcu tempus risus, nec porta orci purus vel lectus. Maecenas nec molestie nisl. Sed id velit ac sapien finibus blandit. In non sed.</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblMon" class="inputMonday">7</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblTue" class="inputTuesday">6</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblWed" class="inputWednesday">4</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblThu" class="inputThursday">7</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblFri" class="inputFriday">7</span>
</div>
</td>
<td class="overflowHidden" style="background-color:#DDDDDD;width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
<span id="lblSat" class="inputSaturday">0</span>
</div>
</td>
<td class="overflowHidden" style="background-color:#DDDDDD;width:4%;" valign="top" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
<span id="lblSun" class="inputSunday">0</span>
</div>
</td>
<td class="overflowHidden" style="background-color:#DDDDDD;width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 100%;">
<span id="lblTotalHours" class="inputTotalRow">31</span>
</div>
</td>
</tr>
</tbody>
</table>
最佳答案
这是因为表格单元格将始终尝试将所有可能的内容放入其尺寸,忽略任何宽度声明,除非您修复其布局。这就像声明 table-layout: fixed
一样简单在 <table>
上有问题的元素,即:
.mytable {
border-collapse: collapse;
border: 1px solid #cccccc;
/* Fix layout */
table-layout: fixed;
}
这是您的代码的一个工作示例(或查看固定 fiddle :http://jsfiddle.net/teddyrised/x397cL72/2/)。您可能希望完整查看它以获得更好的效果:
body {
margin-top: 100px;
background: none repeat scroll 0 0 #f3f3f4;
}
body,
textarea,
* {
font-family: Calibri, Helvetica, sans-serif;
font-size: 14px;
}
.mytable {
border-collapse: collapse;
border: 1px solid #cccccc;
table-layout: fixed;
}
.mytable th,
.mytable td {
border: 1px solid #cccccc;
}
.mytable th {
text-align: center !important;
}
.overflowHidden {
/*display: inline-grid;
display: -ms-inline-grid;*/
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
min-width: 35px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table table-hover table-striped mytable" rules="all" id="gvTimeEntries" style="border-collapse:collapse;" cellspacing="0" border="1">
<thead>
<tr style="color:White;background-color:#00A4E4;font-weight:bold;">
<th class="overflowHidden" scope="col" style="width:17%;">Project</th>
<th class="overflowHidden" scope="col" style="width:17%;">Sub-Project</th>
<th class="overflowHidden" scope="col" style="width:17%;">Task</th>
<th class="overflowHidden" scope="col" style="width:17%;">Description</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Mon</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Tue</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Wed</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Thu</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Fri</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Sat</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Sun</th>
<th class="overflowHidden headerOverflowNormal" scope="col" style="width:4%;" valign="top" align="center">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblProject" title="Rater Onboarding & Support" style="display:inline-block;width:100%;">Maecenas elit ex, feugiat vel fermentum n</span>
</div>
</td>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblSubProject" title="Rater Onboarding and Version Release " style="display:inline-block;width:100%;">consectetur adipiscing elit. Phasellus </span>
</div>
</td>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblTask" title="Design & Development" style="display:inline-block;width:100%;">Sample</span>
</div>
</td>
<td class="overflowHidden" style="width:17%;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblComment" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultrices ligula ut posuere ultrices. Ut facilisis mauris tortor, vitae molestie lorem bibendum eget. Etiam vehicula maximus dui et auctor. Morbi eget pulvinar sapien. Vivamus mi lorem, congue id porta in, interdum vitae lectus. Fusce id viverra justo, quis finibus metus. Ut feugiat consequat metus at volutpat. Phasellus mi leo, vulputate id tortor eu, accumsan eleifend lectus. Nam lobortis feugiat ligula, eget iaculis risus tristique et. Cras at nunc orci. Sed volutpat magna vel nunc dignissim sodales. Maecenas elit ex, feugiat vel fermentum nec, sollicitudin sit amet dui. Etiam dapibus, lacus non facilisis ullamcorper, quam arcu tempus risus, nec porta orci purus vel lectus. Maecenas nec molestie nisl. Sed id velit ac sapien finibus blandit. In non sed.">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultrices ligula ut posuere ultrices. Ut facilisis mauris tortor, vitae molestie lorem bibendum eget. Etiam vehicula maximus dui et auctor. Morbi eget pulvinar sapien. Vivamus mi lorem, congue id porta in, interdum vitae lectus. Fusce id viverra justo, quis finibus metus. Ut feugiat consequat metus at volutpat. Phasellus mi leo, vulputate id tortor eu, accumsan eleifend lectus. Nam lobortis feugiat ligula, eget iaculis risus tristique et. Cras at nunc orci. Sed volutpat magna vel nunc dignissim sodales. Maecenas elit ex, feugiat vel fermentum nec, sollicitudin sit amet dui. Etiam dapibus, lacus non facilisis ullamcorper, quam arcu tempus risus, nec porta orci purus vel lectus. Maecenas nec molestie nisl. Sed id velit ac sapien finibus blandit. In non sed.</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblMon" class="inputMonday">7</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblTue" class="inputTuesday">6</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblWed" class="inputWednesday">4</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblThu" class="inputThursday">7</span>
</div>
</td>
<td class="overflowHidden" style="width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
<span id="lblFri" class="inputFriday">7</span>
</div>
</td>
<td class="overflowHidden" style="background-color:#DDDDDD;width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
<span id="lblSat" class="inputSaturday">0</span>
</div>
</td>
<td class="overflowHidden" style="background-color:#DDDDDD;width:4%;" valign="top" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
<span id="lblSun" class="inputSunday">0</span>
</div>
</td>
<td class="overflowHidden" style="background-color:#DDDDDD;width:4%;" align="center">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 100%;">
<span id="lblTotalHours" class="inputTotalRow">31</span>
</div>
</td>
</tr>
</tbody>
</table>
关于html - 溢出隐藏设置在 IE 11、Firefox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45547583/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!