我可以鼓励表格单元格文本换行吗?
我有一整列的表,其标题由一个问题组成,在接下来的行中仅包含一个复选框......
------------------------------------------------------
| Would you like this text to wrap ? | <rest of row> | <-- <th>
-------------------------------------+----------------
| [] + <rest of row> | <-- <tr>
-------------------------------------+----------------
| [] + <rest of row> | <-- <tr>
它对我来说看起来难看。我可以使用任何标记来“鼓励”浏览器像这样渲染它吗?
---------------------------
| There, | |
| isn't | |
| that | <rest of row> | <-- <th>
| nicer? | |
----------+----------------
| [] | | <-- <tr>
----------+----------------
| [] | | <-- <tr>
----------+----------------
请注意,我不想强迫浏览器进行特定的渲染,只是为了建议一些东西 - 或者被告知这是不可能的。
任何解决方案都必须在 MS IE 7 中运行。
I have one entire column of a table who's header consists of a question and in the following rows contains only a checkbox...
------------------------------------------------------
| Would you like this text to wrap ? | <rest of row> | <-- <th>
-------------------------------------+----------------
| [] + <rest of row> | <-- <tr>
-------------------------------------+----------------
| [] + <rest of row> | <-- <tr>
It looks unsightly to me. Can I use any markup to "encourage" browsers to render it like this...
---------------------------
| There, | |
| isn't | |
| that | <rest of row> | <-- <th>
| nicer? | |
----------+----------------
| [] | | <-- <tr>
----------+----------------
| [] | | <-- <tr>
----------+----------------
Please note that I do NOT want to force the browser into a particular rendering, just to suggest something - or to be told that it is not possible.
Any solution must work in MS IE 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想你能做的最好的事情就是给所选的
th
一个宽度,这里有一些示例代码:http://jsfiddle.net/karameloso/aMTNH/
I guess the best you can do is giving a width to the chosen
th
here some example code: http://jsfiddle.net/karameloso/aMTNH/
设置该列的宽度,例如:
这是一个示例
更新。
按照 Brock Adams 的建议将 px 更改为 em
Set width for that column like:
Here is an example
UPDATE.
Changed px to em's as Brock Adams suggests