英文的wordwrap

CSS文本:word-wrap .28

语法:
word-wrap : normal | break-word
取值:
normal : 默认值。允许内容顶开指定的容器边界
break-word : 内容将在边界内换行。如果需要,词内换行( word-break )也将发生

说明:
设置或检索当当前行超过指定容器的边界时是否断开转行。
此属性仅作用于有布局的对象,如块对象。内联要素要使用该属性,必须先设定对象的 height 或 width 属性,或者设定 position 属性为 absolute ,或者设定 display 属性为 block 。
此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。
对应的脚本特性为 wordWrap 。
示例:
div { word-wrap: break-word; word-break: break-all; }

wordwrap

(PHP 4 >= 4.0.2)

wordwrap --  Wraps a string to a given number of characters using a string break character.

Description

string wordwrap ( string str [, int width [, string break [, boolean cut]]])

Returns a string with str wrapped at the column number specified by the optional width parameter. The line is broken using the (optional) break parameter.

wordwrap() will automatically wrap at column 75 and break using '/n' (newline) if width or break are not given.

If the cut is set to 1, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken apart. (See second example).

注: The optional cut parameter was added in PHP 4.0.3

例子 1. wordwrap() example

<?php
$text
= "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />");

echo
"$newtext/n";
?>

This example would display:

The quick brown fox
jumped over the 
lazy dog.

例子 2. wordwrap() example

<?php
$text
= "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "/n", 1);

echo
"$newtext/n";
?>

This example would display:

A very
long
wooooooo
ooooord.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值