Home >Web Front-end >CSS Tutorial >How to Wrap Text in Fixed-Width HTML Buttons?
In HTML buttons, assigning a fixed width can restrict the display of text within. Unlike table cells, buttons typically do not wrap their content automatically. To rectify this issue, the word-wrap property is often used, but it can break words abruptly, leaving the end result undesirable.
Solution:
To ensure text wraps in HTML buttons as it would in table cells, utilize the white-space CSS property. Set the value to normal, which allows the text to break at its natural word boundaries:
<code class="css">white-space: normal;</code>
By applying this property, the text within the button will be displayed as expected, wrapping within the specified fixed width.
The above is the detailed content of How to Wrap Text in Fixed-Width HTML Buttons?. For more information, please follow other related articles on the PHP Chinese website!