Hướng dẫn php wordwrap into array - php wordwrap thành mảng

Hàm 

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
1 sẽ thêm một kí tự hoặc một thẻ nào đó vào chuỗi khi đã đếm đủ số kí tự nhất định. Ví dụ cứ sau mỗi 20 kí tự ta sẽ xuống dòng, trong trường hợp này ta sẽ sử dụng hàm 
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
1 để xử lý.

Hướng dẫn php wordwrap into array - php wordwrap thành mảng

Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức.freetuts.net, không được copy dưới mọi hình thức.

Cú pháp

Cú pháp: 

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
3
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
3

Trong đó::

  • this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    4 là chuỗi cần xử lý..
  • this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    5 là độ dài mà cứ sau
    this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    5 kí tự sẽ thêm
    this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    7 vào chuỗi
    this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    4.
  • this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    9 là tham số. Mặc định là FALSE. 
    • tag {
          word-wrap: giá trị;
      }
      0, cứ
      this is a test-stringgggggggggggggggggggggggg
      this is-a test-stringgg-gggggggg-gggggggg-gggggg
      this is-a test-stringgggggggggggggggggggggggg
      5 kí tự trong chuỗi thì sẽ thêm
      this is a test-stringgggggggggggggggggggggggg
      this is-a test-stringgg-gggggggg-gggggggg-gggggg
      this is-a test-stringgggggggggggggggggggggggg
      7 vào vị trí tiếp theo.
    • tag {
          word-wrap: giá trị;
      }
      3, Hàm sẽ không cắt ngang các từ kể cả khi đã vượt quá 
      tag {
          word-wrap: giá trị;
      }
      4kí tự.

Cách sử dụng hàm wordwrap:

Bài viết này được đăng tại [free tuts .net]

Code

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";

Kết quả

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg

Tham khảo: php.net

  • Trang chủ
  • Tham khảo
  • CSS
  • CSS3
  • Thuộc tính word-wrap

Định nghĩa và sử dụng

Thuộc tính word-wrap sẽ làm cho những từ dài xuống hàng mà không làm vỡ layout.

Cấu trúc

tag {
    word-wrap: giá trị;
}

word-wrap có các giá trị như sau:

Thuộc tínhgiá trịVí dụMô tả
word-wrap break-word word-wrap: break-word; Những từ quá dài sẽ xuống hàng.
normal word-wrap: normal; Trả về dạng mặc định ban đầu cho word-wrap.

Ví dụ

Mô tả




HỌC WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEB CHUẨN

word-wrap

p {
    border: 1px solid #cc0000;
    width: 150px;
}

break-word

word-wrap: break-word;

Những từ quá dài sẽ xuống hàng.

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}

normal

word-wrap: break-word;

Hàm 

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
1 sẽ thêm một kí tự hoặc một thẻ nào đó vào chuỗi khi đã đếm đủ số kí tự nhất định. Ví dụ cứ sau mỗi 20 kí tự ta sẽ xuống dòng, trong trường hợp này ta sẽ sử dụng hàm 
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
1 để xử lý.

Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức.freetuts.net, không được copy dưới mọi hình thức.

Cú pháp

Cú pháp: 

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
3
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
3

Trong đó::

  • this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    4 là chuỗi cần xử lý..
  • this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    5 là độ dài mà cứ sau
    this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    5 kí tự sẽ thêm
    this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    7 vào chuỗi
    this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    4.
  • this is a test-stringgggggggggggggggggggggggg
    this is-a test-stringgg-gggggggg-gggggggg-gggggg
    this is-a test-stringgggggggggggggggggggggggg
    9 là tham số. Mặc định là FALSE. 
    • tag {
          word-wrap: giá trị;
      }
      0, cứ
      this is a test-stringgggggggggggggggggggggggg
      this is-a test-stringgg-gggggggg-gggggggg-gggggg
      this is-a test-stringgggggggggggggggggggggggg
      5 kí tự trong chuỗi thì sẽ thêm
      this is a test-stringgggggggggggggggggggggggg
      this is-a test-stringgg-gggggggg-gggggggg-gggggg
      this is-a test-stringgggggggggggggggggggggggg
      7 vào vị trí tiếp theo.
    • tag {
          word-wrap: giá trị;
      }
      3, Hàm sẽ không cắt ngang các từ kể cả khi đã vượt quá 
      tag {
          word-wrap: giá trị;
      }
      4kí tự.

Cách sử dụng hàm wordwrap:

Bài viết này được đăng tại [free tuts .net]

Code

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";

Kết quả

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg

Tham khảo: php.net

Trang chủ

Tham khảo打断字符串为指定数量的字串

CSS

Thuộc tính word-wrap(
    string

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
4,
    int
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
5 = 75
,
    string
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
7 = "\n"
,
    bool
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
9 =
p {
    border: 1px solid #cc0000;
    width: 150px;
}
3

): string

Định nghĩa và sử dụng

Thuộc tính word-wrap sẽ làm cho những từ dài xuống hàng mà không làm vỡ layout.

Cấu trúc

word-wrap có các giá trị như sau:

Thuộc tính

giá trị

Ví dụ

Mô tả

word-wrap

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
0,字符串总是在指定的
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 或者之前位置被打断。因此,如果有的单词宽度超过了给定的宽度,它将被分隔开来。(参见第二个范例)。 当它是
p {
    border: 1px solid #cc0000;
    width: 150px;
}
3
,函数不会分割单词,哪怕
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 小于单词宽度。

break-word

word-wrap: break-word; wordwrap() 范例

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
4

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
5

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
6

Những từ quá dài sẽ xuống hàng.

The quick brown fox
jumped over the lazy
dog.

normal wordwrap() 范例

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
7

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
5

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
9

Những từ quá dài sẽ xuống hàng.

A very
long
wooooooo
ooooord.

normal wordwrap() 例子

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
0

p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
5

word-wrap: normal;

Những từ quá dài sẽ xuống hàng.

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

normal

  • word-wrap: normal;
  • Trả về dạng mặc định ban đầu cho word-wrap.

HTML viết:

CSS viết:

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
3

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
4

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
5

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
6

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
7

Hiển thị trình duyệt khi chưa có word-wrap:

HỌC WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEB CHUẨN

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
8

$text = "this is a test stringgggggggggggggggggggggggg";
echo $newtext = wordwrap($text, 20, "-")."
"; echo $newtext = wordwrap($text, 8, "-", true)."
"; echo $newtext = wordwrap($text, 8, "-", false)."
";
9

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

Thêm thuộc tính word-wrap vào CSS:

Hiển thị trình duyệt khi có word-wrap:

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
1

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
2

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

Hiển thị trình duyệt khi có word-wrap:

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
4

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
5

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
6

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
7

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

wordwrap — 打断字符串为指定数量的字串

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
9

The quick brown fox
jumped over the lazy
dog.
0

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

说明

wordwrap(    string

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
4,    int
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
5 = 75,    string
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
7 = "\n",    bool
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
9 =
p {
    border: 1px solid #cc0000;
    width: 150px;
}
3): string

The quick brown fox
jumped over the lazy
dog.
2

The quick brown fox
jumped over the lazy
dog.
3

The quick brown fox
jumped over the lazy
dog.
4

The quick brown fox
jumped over the lazy
dog.
5

The quick brown fox
jumped over the lazy
dog.
6

参数

p {
    border: 1px solid #cc0000;
    width: 150px;
}
4

输入字符串。

The quick brown fox
jumped over the lazy
dog.
8

The quick brown fox
jumped over the lazy
dog.
9

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

p {
    border: 1px solid #cc0000;
    width: 150px;
}
5

列宽度。

A very
long
wooooooo
ooooord.
1

A very
long
wooooooo
ooooord.
2

A very
long
wooooooo
ooooord.
3

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

p {
    border: 1px solid #cc0000;
    width: 150px;
}
6

使用可选的

p {
    border: 1px solid #cc0000;
    width: 150px;
}
6 参数打断字符串。

A very
long
wooooooo
ooooord.
5

A very
long
wooooooo
ooooord.
6

A very
long
wooooooo
ooooord.
7

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

p {
    border: 1px solid #cc0000;
    width: 150px;
}
8

如果

p {
    border: 1px solid #cc0000;
    width: 150px;
}
8 设置为
p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
0,字符串总是在指定的
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 或者之前位置被打断。因此,如果有的单词宽度超过了给定的宽度,它将被分隔开来。(参见第二个范例)。 当它是
p {
    border: 1px solid #cc0000;
    width: 150px;
}
3 ,函数不会分割单词,哪怕
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 小于单词宽度。

A very
long
wooooooo
ooooord.
9

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
00

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
01

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
02

范例

wordwrap(    string

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
4,    int
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
5 = 75,    string
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
7 = "\n",    bool
this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
9 =
p {
    border: 1px solid #cc0000;
    width: 150px;
}
3): string

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
03

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
04

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
05

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
06

参数

如果

p {
    border: 1px solid #cc0000;
    width: 150px;
}
8 设置为
p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
0,字符串总是在指定的
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 或者之前位置被打断。因此,如果有的单词宽度超过了给定的宽度,它将被分隔开来。(参见第二个范例)。 当它是
p {
    border: 1px solid #cc0000;
    width: 150px;
}
3 ,函数不会分割单词,哪怕
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 小于单词宽度。

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
07

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
08

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

范例

示例 #1 wordwrap() 范例

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
10

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
11

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
12

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
13

以上例程会输出:

示例 #2 wordwrap() 范例

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
14

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
15

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
16

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
17

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
18

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

示例 #3 wordwrap() 例子

CSS viết:

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
20

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
21

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

Hiển thị trình duyệt khi chưa có word-wrap:

HỌC WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEB CHUẨN

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
23

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
24

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
25

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

Thêm thuộc tính word-wrap vào CSS:

使用可选的

p {
    border: 1px solid #cc0000;
    width: 150px;
}
6 参数打断字符串。

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
27

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
28

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
29

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
30

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
31

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

p {
    border: 1px solid #cc0000;
    width: 150px;
}
8

如果

p {
    border: 1px solid #cc0000;
    width: 150px;
}
8 设置为
p {
    border: 1px solid #cc0000;
    width: 150px;
    word-wrap: break-word;
}
0,字符串总是在指定的
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 或者之前位置被打断。因此,如果有的单词宽度超过了给定的宽度,它将被分隔开来。(参见第二个范例)。 当它是
p {
    border: 1px solid #cc0000;
    width: 150px;
}
3 ,函数不会分割单词,哪怕
p {
    border: 1px solid #cc0000;
    width: 150px;
}
5 小于单词宽度。

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
33

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
34

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
35

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
36

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
37

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
38

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
39

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
40

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
41

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
42

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

Zac dot hester tại gmail dot com ¶

7 năm trước

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
44

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
45

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
46

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

BruceBoughton @ Google Mail ¶

17 năm trước

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
48

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
49

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
50

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

nbenitezl [arroba] gmail [dot] com ¶

11 năm trước

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
52

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
53

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
54

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
55

Matt tại Newbiewebdevelopment dot idk ¶

13 năm trước

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
56

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
57

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0

Simbiat tại bk dot ru ¶

5 năm trước

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
59

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
60

this is a test-stringgggggggggggggggggggggggg
this is-a test-stringgg-gggggggg-gggggggg-gggggg
this is-a test-stringgggggggggggggggggggggggg
0