word-wrap同word-break的区别
来源:cz268.com 发布时间:2007-10-24 20:08:00
本文列举了兼容 IE 和 FF 的换行 CSS 推荐样式,详细介绍了word-wrap同word-break的区别。
兼容 IE 和 FF 的换行 CSS 推荐样式 ;
最好的方式是
word-wrap:break-word; overflow:hidden;
而不是
word-wrap:break-word; word-break:break-all;
也不是
word-wrap:break-word; overflow:auto;
在 IE 下没有任何问题,在 FF 下,长串英文会被遮住超出的内容。
word-wrap同word-break的区别
以下为引用的内容:
word-wrap:
normal Default. Content exceeds the boundaries of its container.
break-word Content wraps to next line, and a word-break occurs when necessary. 必要时会触发word-break。
word-break:
normal Default. Allows line breaking within words. 好像是只对Asian text起作用。
break-all Behaves the same as normal for Asian text, yet allows the line to break arbitrarily for non-Asian text. This value is suited to Asian text that contains some excerpts of non-Asian text.
keep-all Does not allow word breaking for Chinese, Japanese, and Korean. Functions the same way as normal for all non-Asian languages. This value is optimized for text that includes small amounts of Chinese, Japanese, or Korean.
总结如下:
word-wrap是控制换行的。
使用break-word时,是将强制换行。中文没有任何问题,英文语句也没问题。但是对于长串的英文,就不起作用。
break-word是控制是否断词的。
normal是默认情况,英文单词不被拆开。
break-all,是断开单词。在单词到边界时,下个字母自动到下一行。主要解决了长串英文的问题。 keep-all,是指Chinese, Japanese, and Korean不断词。即只用此时,不用word-wrap,中文就不会换行了。(英文语句正常。)
ie下:
使用word-wrap:break-word;所有的都正常。
ff下: 如这2个都不用的话,中文不会出任何问题。英文语句也不会出问题。但是,长串英文会出问题。
为了解决长串英文,一般用word-wrap:break-word;word-break:break-all;。但是,此方式会导致,普通的英文语句中的单词会被断开(ie下也是)。
目前主要的问题存在于 长串英文 和 英文单词被断开。其实长串英文就是一个比较长的单词而已。
即英文单词应不应该被断开那?那问题很明显了,显然不应该被断开了。
对于长串英文,就是恶意的东西,自然不用去管了。但是,也要想些办法,不让它把容器撑大。
用:overflow:auto; ie下,长串会自动折行。ff下,长串会被遮盖。
所以,综上,最好的方式是word-wrap:break-word;overflow:hidden;而不是word-wrap:break-word;word-break:break-all;。
word-wrap:break-word;overflow:auto;在ie下没有任何问题。在ff下,长串会被遮住部分内容。
另,测试代码如下:
猜你喜欢
- excel写入数据,使用openpyxl库class WriteExcel: def __init__(self,path):
- 一、简介flask中session组件可分为内置的session组件还有第三方flask-session组件,内置的session组件功能单
- 本文通过实际业务系统中调整的一个案例,试图给出一个常见CPU消耗问题的一个诊断方法.大多数情况下,系统的性能问题都是由不良SQL代码引起的,
- 我们了解到gin可用通过类似DefaultQuery或DefaultPostForm等方法获取到前端提交过来的参数。参数不多的情况下也很好用
- 1. 文件夹结构指定文件夹:E:/Code/Python/test指定文件:test.txt指定文件夹下的目录及文件:文件夹a:a.txtt
- 1. 准备工作首先编写getHtml函数,传入markdown文本字符串,这里使用fs读取markdown文件内容,返回值是转换过后的字符串
- 需求:根据医保中心的文档和提供的dll动态库调用相关接口下载医保中心的账单。文档:对调用dll动态库的描述,调用哪个dll文件,同时了解清楚
- 1. 引言Python程序有许多模块和第三方包,这非常有助于高效编程。了解这些模块的正确使用方法是很重要的,在本文中,主要介绍一些非常实用的
- 前言:.net6LTS版本发布已经有若干天了。此处做一个关于使用.net6开发精简版webapi(minimalapi)的入门教程,以及VS
- <? // 建立一个指向新COM组件的索引 $word = new C
- 1。建立数据库表 表名为online 设如下字段 id '用来记录每一个访问都的session.sessionid name
- 在Oracle数据库中,DBA可以通过观测一定的表或视图来了解当前空间的使用状况,进而作出可能的调整决定。 一.表空间的自由空间 通过对表空
- threading.Event机制类似于一个线程向其它多个线程发号施令的模式,其它线程都会持有一个threading.Event的对象,这些
- 一、Pythont如何打开 txt 格式的文件?1.首先我使用pycharm创建一个项目,然后在这个项目里面再创建一个python的包,然后
- 一、简单使用def TestLogBasic(): import logging  
- 首先贴一张验证码上来做案例:第一步先通过二值化处理把干扰线去掉:from PIL import Image# 二值化处理def two_va
- 分析摩斯密码是一种将文本信息作为一系列通断的音调、灯光或咔嗒声传输的方法,无需特殊设备,熟记的小伙伴即可直接翻译。它以电报发明者Samuel
- 本文实例讲述了MySQL主从复制与读写分离原理及用法。分享给大家供大家参考,具体如下:主从复制概念影响MySQL-A数据库的操作,在数据库执
- QueueTornado的tornado.queue模块为基于协程的应用程序实现了一个异步生产者/消费者模式的队列。这与python标准库为
- 问题描述:为了把之前的CPU版本的tensorflow卸载,换成GPU版本的tensorflow,经历了一番折腾。BUG1 Could no