如何在< p>中包装文本如果文本没有空格并且非常长,则标记 [英] How to wrap text in <p> tag if the text has no spaces and is verylong

查看:57
本文介绍了如何在< p>中包装文本如果文本没有空格并且非常长,则标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果文本没有空格并且

长,如何在< ptag中包装文本?下面是一个例子:


将p为H. VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongV eryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVer yVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVeryV eryLongVeryVeryLong< /

p为H.


以上这条线很长,应该换行。但是因为它没有空格,所以它没有空间。相反,整个文本确实在一行

行。在Dreamweaver中,它们向您显示正在进行的文本

右侧,大约3个屏幕长度。但是在Firefox中,文本经过div

边界(即边界右边)没有出现。


奇怪的是,这个谷歌编辑如果

文本中有空格,它们也只进行文本换行。但是如果没有空格,那么你必须滚动到

右边才能看到所有的< ptag。


BTW,我也试过把文字放进去进入< blockquote>。

解决方案

2008-03-29, re ************* @ yahoo.com < re ************* @ yahoo.comwrote:


如果文本没有空格并且

长,如何在< ptag中包装文本?下面是一个例子:

< p为H. VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLo ngVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLong VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVe ryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVery VeryLongVeryVeryLong< /

p为H.


上面的线是这么久它应该包裹起来。但是因为它没有空格,所以它没有空间。相反,整个文本确实在一行

行。在Dreamweaver中,它们向您显示正在进行的文本

右侧,大约3个屏幕长度。但是在Firefox中,经过div

边界(即边界右边)的文本没有显示出来。



让它在浏览器中换行的唯一方法是将零宽度打破

空格。

这应该有效:


VeryVeryLongVery长字


将字符放在您认为浏览器应该的位置
打破文本。它并没有让它在那里打破(使用< brfor

),它只是创造了一个破门的机会。


替代是非标准< wbrelement:


VeryVeryLongVery< wbr>长字


这是非标准的,但有些浏览器可能会支持< wbrthat不支持

我不确定。


在文章< sl ****** ***************@bowser.marioworld>,

Ben C< sp ****** @ spam.eggswrote:
< blockquote class =post_quotes>
2008-03-29, re **** *********@yahoo.com < re ************* @ yahoo.comwrote:


如果文本没有空格并且

长,如何在< ptag中包装文本?下面是一个例子:


将p为H. VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVe

ryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVery VeryLongVeryVeryLongVeryVer

yLongVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryL ongVeryVeryLong< /

p>


以上行很长,应该换行。但是因为它没有空格,所以它没有空间。相反,整个文本确实在一行

行。在Dreamweaver中,它们向您显示正在进行的文本

右侧,大约3个屏幕长度。但是在Firefox中,经过div

边界(即边界右边)的文本没有显示出来。



使其在浏览器中换行的唯一方法是将零宽度打破

空格。

这应该有效:


VeryVeryLongVery长字


将字符放在您认为浏览器应该的位置
打破文本。它并没有让它在那里打破(使用< brfor

),它只是创造了一个破门的机会。


替代是非标准< wbrelement:


VeryVeryLongVery< wbr>长字


这是非标准的,但有些浏览器可能会支持< wbrthat不支持

我不确定。



有一个浏览器用wbr,和­做什么的表格。 at:

< http://www.quirksmode.org/oddsandends/wbr.html>


-

dorayme


Scripsit Ben C:


>>< p> VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryL ongVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongV eryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVer yVeryLongVeryVeryLong< /
p>



第一个问题是:为什么有人会写这样的怪物?

第二个问题是:如果你希望它被浏览器打破,

应该是浏览器读你的想法来决定它是否应该连字符

或者只是打破它?


使它在浏览器中换行的唯一方法是将零宽度打破

空格。



不,不如你后面描述的那样。此外,由浏览器来决定是否自动将字词连字。目前他们已经决定不会。
决定不这样做。目前定义的CSS中没有任何内容可以建议

连字符或断字符串而不用连字符 -


这应该有效:


VeryVeryLongVery Longword



应该吗?按哪种规格?请注意HTML规范要求
不要求Unicode一致性或支持特定的Unicode

字符。


It'这是非标准的,但有些浏览器可能会支持< wbrthat没有

支持我不确定。



我是。 < wbrmarkup得到了更好的支持,并且不知道

导致任何麻烦,不像实际上可能使用

字形为不支持的字符呈现。


更多信息: http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest


-

Jukka K. Korpela(Yucca)
http:/ /www.cs.tut.fi/~jkorpela/


How to wrap text in <ptag if the text has no spaces and is very
long? Here is an example:

<p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongV eryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVer yVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVeryV eryLongVeryVeryLong</
p>

The above line is so long that it ought to wrap. But because it has
no spaces, it does not wrap. Instead the entire text is really on one
line. In Dreamweaver they show you the text going on and on to the
right, about 3 screen lengths. But in Firefox, the text past the div
boundary (ie. to the right of the boundry) does not show up.

Strangely, this google editor they also only do text wrapping if the
text has spaces in it. But if no spaces, then you have to scroll to
the right to see all of the <ptag.

BTW, I also tried putting the text into <blockquote>.

解决方案

On 2008-03-29, re*************@yahoo.com <re*************@yahoo.comwrote:

How to wrap text in <ptag if the text has no spaces and is very
long? Here is an example:

<p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLo ngVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLong VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVe ryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVery VeryLongVeryVeryLong</
p>

The above line is so long that it ought to wrap. But because it has
no spaces, it does not wrap. Instead the entire text is really on one
line. In Dreamweaver they show you the text going on and on to the
right, about 3 screen lengths. But in Firefox, the text past the div
boundary (ie. to the right of the boundry) does not show up.

The only way to make it wrap in browsers is to put zero-width breaking
spaces in.

This should work:

VeryVeryLongVery​Longword

Put the ​ characters in wherever you think the browser should
break the text. It doesn''t make it break there and then (use <brfor
that), it just creates a breaking opportunity.

An alternative to ​ is the non-standard <wbrelement:

VeryVeryLongVery<wbr>Longword

It''s non-standard but some browsers may support <wbrthat don''t support
​ I''m not sure.


In article <sl*********************@bowser.marioworld>,
Ben C <sp******@spam.eggswrote:

On 2008-03-29, re*************@yahoo.com <re*************@yahoo.comwrote:

How to wrap text in <ptag if the text has no spaces and is very
long? Here is an example:

<p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVe
ryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVery VeryLongVeryVeryLongVeryVer
yLongVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryL ongVeryVeryLong</
p>

The above line is so long that it ought to wrap. But because it has
no spaces, it does not wrap. Instead the entire text is really on one
line. In Dreamweaver they show you the text going on and on to the
right, about 3 screen lengths. But in Firefox, the text past the div
boundary (ie. to the right of the boundry) does not show up.


The only way to make it wrap in browsers is to put zero-width breaking
spaces in.

This should work:

VeryVeryLongVery​Longword

Put the ​ characters in wherever you think the browser should
break the text. It doesn''t make it break there and then (use <brfor
that), it just creates a breaking opportunity.

An alternative to ​ is the non-standard <wbrelement:

VeryVeryLongVery<wbr>Longword

It''s non-standard but some browsers may support <wbrthat don''t support
​ I''m not sure.

There is a table of what browsers do with wbr, ​, and ­ at:
<http://www.quirksmode.org/oddsandends/wbr.html>

--
dorayme


Scripsit Ben C:

>><p>VeryVeryLongVeryVeryLongVeryVeryLongVeryVeryL ongVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLon gVeryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongV eryVeryLongVeryVeryLongVeryVeryLongVeryVeryLongVer yVeryLongVeryVeryLong</
p>

This first question is: why would anyone write such a monstrosity? The
second question is: if you would like it to be broken by a browser,
should the browser read your mind to decide whether it should hyphenate
or just break it?

The only way to make it wrap in browsers is to put zero-width breaking
spaces in.

No it isn''t, as you describe later. Besides, it is up to browsers to
decide whether they automatically hyphenate words. Currently they have
decided not to. There is nothing in CSS as currently defined to suggest
either hyphenation or breaking strings without hyphenation-

This should work:

VeryVeryLongVery​Longword

Should it? By which specification? Beware that HTML specifications do
not require Unicode conformance or support to particular Unicode
characters.

It''s non-standard but some browsers may support <wbrthat don''t
support ​ I''m not sure.

I am. The <wbrmarkup is far better supported and it is not know to
cause any trouble, unlike ​ which may in fact be rendered using a
glyph for unsupported characters.

More info: http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


这篇关于如何在&lt; p&gt;中包装文本如果文本没有空格并且非常长,则标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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