How to Make Text Wrap in Fixed-Width HTML Buttons?

Mary-Kate Olsen
Release: 2024-10-31 09:16:29
Original
255 people have browsed it

How to Make Text Wrap in Fixed-Width HTML Buttons?

How to Control Text Wrapping in Fixed-Width HTML Buttons

In HTML buttons with a predefined width, text often remains unbreakable, leading to awkward truncation. This article explores a solution to this issue, enabling the seamless wrapping of button text like table cells.

One failed approach involves using the word-wrap property. While it may seem intuitive, it can result in words being cut off mid-character.

Instead, the key lies in the white-space CSS property. Setting it to normal for the button allows the text to break as it would in regular text:

<code class="css">white-space: normal;</code>
Copy after login

Consider the following button:

<code class="html"><input type="submit" ... style="width: 200px; white-space: normal;">Roos Sturingen / Sensors</input></code>
Copy after login

With the white-space property set to normal, the text will wrap gracefully within the fixed width, avoiding unsightly word segmentation.

The above is the detailed content of How to Make Text Wrap in Fixed-Width HTML Buttons?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!