Use word-wrap: break-word to automatically wrap text

Source: Internet
Author: User

Text Box continuous input
Number "111111111111111111" or
The English word "adkjsakfjsalfkjsalkdjaslkfjsalkf"
What will happen? --- Text overflow. The general solution is to use overflow: hidden to hide text. Is there a better solution to text? For children's shoes of QA, automatic line breaks are required.

Use word-wrap: break-word.

Explanation in the css Manual
Basic Features
Compatibility: IE5.5 + private attributes
Basic syntax
Word-wrap: normal | break-word
Syntax Value
Normal: default value. Allows the content to expand the specified container Boundary
Break-word: the content will wrap in the boundary. If necessary, the line feed (word-break) will also occur.
Instructions for use
Sets or retrieves whether to disconnect the dashboard when the forward time exceeds the boundary of the specified container. This attribute only applies to layout objects, such as block objects. To use this attribute for inline elements, you must first set the height or width attribute of the object, set the position attribute to absolute, or set the display attribute to block. This attribute is read-only for currentStyle objects. Other objects can be read and written. The corresponding script feature is wordWrap.

W3c explanation


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.