html - 文本不适合方框。 CSS 问题

标签 html css

background:url(images/page_text.png) repeat-y;  
margin: 0 auto; 
width: 949px;
padding: 20px;
line-height: 100%;

那是我的 CSS。怎么了?当我写长句时,它不适合 page_text.png 框(这很有趣,但只在 IE 中,它工作正常)。我想我错过了什么。

最佳答案

你需要设置分词...不幸的是,它在浏览器之间并不一致,所以你使用下面的代码在所有浏览器上强制它。这是explained here

white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */

关于html - 文本不适合方框。 CSS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5819475/

相关文章:

javascript - 嵌入 slickgrid 图形以填充浏览器窗口

html代码在不同位置将三个图像放在一个背景图像上

javascript - 如何将自定义js添加到HTML

html - 如何让我的导航栏在滚动时保持在页面顶部?

jquery - ios 7 browser-kit 围绕 div 元素的黑色边框

html - CSS 代码适用于 firefox 和 IE,但不适用于 chrome

php - javascript改变显示样式

html - 向 <hr> 数据内容文本添加渐变边框底部

css - Vanilla Bootstrap : 12 columns go beyond the screen

html - 如何使移动屏幕的图像居中(使用 HTML)?