过长文字自动换行的技巧 Word-Break Word-Wrap_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:25:23
Original
1868 people have browsed it

在很多时候,为了防止内容过长把表格或容器撑破, 我们都需要为容器加上自动换行的功能。

实现自动换行,用CSS来实现,通常有两种方式:

  • word-break:
  • 取值为 normal, break-all, keep-all

  • word-wrap:
  • 取值为 normal, break-word

    word-break: break-all 太霸道,无条件折行,会造成 英文单词 和 数字的断行,不建议使用。

    推荐使用的是:

    首先新建html文件,将下面的代码考入:

    {word-wrap: break-word; overflow: hidden; text-overflow: ellipsis;}
    Copy after login


    对 FF3 应该是兼容的。

    来自:http://goodboy5264.blog.163.com/blog/static/253829820091110305144/

    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template