为什么自动换行在CSS3中不能正常工作? [英] Why doesn't word-wrap work properly in CSS3?

查看:35
本文介绍了为什么自动换行在CSS3中不能正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的示例中,为什么自动换行属性不能正常工作?

Why doesn't word wrap property work properly in the example below?

http://jsfiddle.net/k5VET/739/

我该怎么做才能确保单词 consectetur的一部分是否适合第一行?我希望每行中能容纳的最大字符数。

What can I do to ensure that part of the word 'consectetur' fits in the first line itself? I want maximum number of characters to fit in each line.

css是:

#fos { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size:14px;
    font-weight: normal;
    line-height: 18px;
    width: 238px;
    height:38px;
    cursor: pointer;
    word-wrap:break-word;
    border:2px solid; }


推荐答案

使用断字:全能;

#fos { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size:14px;
    font-weight: normal;
    line-height: 18px;
    width: 238px;
    height:38px;
    cursor: pointer;
word-break: break-all;
    border:2px solid; }

实时演示

这篇关于为什么自动换行在CSS3中不能正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆