Home >Web Front-end >CSS Tutorial >How to Wrap Text in a Without Whitespace?

How to Wrap Text in a Without Whitespace?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-09 00:44:01728browse

How to Wrap Text in a <td> Without Whitespace? 
Without Whitespace? " />

Wrapping Text Without White Space in a

To enable text wrapping within a without any white spaces, the following approach can be utilized:

.wrapword {
    white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
    white-space: -webkit-pre-wrap;          /* Chrome &amp; Safari */ 
    white-space: -pre-wrap;                 /* Opera 4-6 */
    white-space: -o-pre-wrap;               /* Opera 7 */
    white-space: pre-wrap;                  /* CSS3 */
    word-wrap: break-word;                  /* Internet Explorer 5.5+ */
    word-break: break-all;
    white-space: normal;
}

To implement this, the following HTML structure can be used:

<table>

In this example, a 400px wide table is created with a fixed layout. The element is assigned the "wrapword" class, which applies the CSS styling to enable text wrapping.

This approach effectively wraps text within the without introducing any whitespace breaks, even for continuous strings of characters. It has been tested on Firefox 5.0, Internet Explorer 8.0, and Chrome 10.

The above is the detailed content of How to Wrap Text in a Without Whitespace?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn