带有自动换行的PRE标签中的问题 [英] Issue in PRE tag with word wrap

查看:78
本文介绍了带有自动换行的PRE标签中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对我来说,PRE标签中的自动换行正常,但< TD>保持PRE标签偏离< TD>的指定宽度。或< PRE>。这会影响屏幕的布局。

For me, word wrapping in PRE tag works fine, but the <TD> which holds the PRE tag goes off the specified width of the <TD> or <PRE>. This affects the layout of the screen.

有人可以建议我一个解决方案吗?

Can anyone suggest me a solution?

我的代码如下:

< TABLE> < TR>< TD width =" 300">

<TABLE><TR><TD width="300">

< PRE style =" width:300px;自动换行:break:word">

<PRE style="width:300px;word-wrap:break:word">

冗长的文字到这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!冗长的文字在这里!!!

Lengthy text goes here !!! Lengthy text goes here !!!Lengthy text goes here !!!Lengthy text goes here !!! Lengthy text goes here !!! Lengthy text goes here !!!Lengthy text goes here !!!Lengthy text goes here !!!Lengthy text goes here !!!Lengthy text goes here !!!Lengthy text goes here !!!

< / PRE>< / TD>< / TR>< / TABLE>

</PRE></TD></TR></TABLE>

问候

Devi Sri

推荐答案

试试这个:

< 样式 =" width:300px; table-layout:fixed; " >
< tr
>
< ; td style =" width :100%;
">
< pre style = " 自动换行:break-word ;"> 一些很长的文字phnar phnar < / pre
>
< / td
>
< / tr
>
< / table >

<table style="width: 300px; table-layout: fixed;">
  <tr
>
   
<td style="width: 100%;
">
     
<pre style="word-wrap: break-word;">Some quite long text phnar phnar</pre
>
   
</td
>
 
</tr
>
</table>

关键是表格布局:固定; - 这将使表格超出您在宽度中指定的范围。自动换行:break-word;会导致预先换行,而不是从桌子的边缘消失。


这篇关于带有自动换行的PRE标签中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆