html - 当浏览器放大/缩小时,如何防止表格 <TD> 部分内的文本换行(移动)?

标签 html css html-table

我有一个表格,无论浏览器是否放大,我都想在其中显示段落的原样。例如,在下图中:

enter image description here

第一段的最后一行应该始终以“突然她要和这个人回去了。”第二段的最后一行应该只包含最后一个词,< em>“回来。”。我希望它保持这种状态,因为我想稍后在左侧添加一个包含行号的列。

现在发生的情况是,当我使用 Web 浏览器 (Google Chrome) 放大或缩小时,文字往往会移动并换行到下一行,从而破坏了段落的恒定状态。

<table>
<tbody>
<tr>  

<td width="422px">
<p style="text-align: justify; font-size: medium; font-family: 'Century Gothic',futura;">My biking beginnings can be summed up in two words: teenage love. My first girlfriend was small with mousy blonde hair and I was mad about her. Our romance came to an abrupt end however, when she started going out with another guy in my hometown, Crieff. He rode a 50 cc road bike first and then a 125. And whereas I had always walked my girlfriend home, suddenly she was going back with this guy.</p>

<p style="text-align: justify; font-size: medium; font-family: 'Century Gothic',futura;">I was nearly sixteen by then and already heartbroken. Then one day, on the way back from a shopping trip to Perth with my mum, we passed Buchan's, the local bike shop. I urged my mother to stop the car. I got out, walked up the short hill to the shop and pressed my nose to the window. There was a light blue 50cc bike on display right at the front of the shop. I didn't know what make it was, or if it was any good. Such trivialities were irrelevant to me. All I knew was that I could get it in three or four months time when I was sixteen and allowed to ride it. Maybe I could even get my girlfriend back.</p>
</td>
</tr>
</tbody>
</table>

最佳答案

您可以对段落使用white-space: pre 样式,但您的文本应该分成几行。现在每个段落都在一行中。

样本:http://jsfiddle.net/LD3uC/1/

关于html - 当浏览器放大/缩小时,如何防止表格 <TD> 部分内的文本换行(移动)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20042466/

相关文章:

html - gmail html 在移动设备上不起作用它会忽略媒体查询吗?

css - 如何使用下面的 css 作为表行 (tr) 的内联?

javascript - Jquery 解析 HTML 表

javascript - 使用 PhoneGap 和 JQuery Mobile 转到下一页

javascript - 如何编写 JavaScript 函数从 HTML 5 视频播放器获取位图数据?

javascript - Bootstrap 下拉菜单 - 无法正常工作

php - 在php中使用html表标签的php语法错误

javascript - 如何限制可折叠项目保持展开状态,除非我单击其他可折叠项目进行展开而不是可折叠项目本身

html - 如何使用 Bootstrap CDN?

html - 显示:内联 block 不适用于 div