“Pr text white space”的版本间差异

本页内容
(创建页面,内容为“{{DISPLAYTITLE:white-space}}12 = CSS white-space 属性 = 规定段落中的文本不进行换行: <sample title="" desc="" lang="html" hererun="1"> p { white-space:nowrap; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> p { white-space:nowrap; } </style> </head> <body> <p> This is some text. This is some text. This is some text. This is some tex…”)
 
Neo讨论 | 贡献
无编辑摘要
第57行: 第57行:
{| class="table table-striped table-hover"
{| class="table table-striped table-hover"
! 属性
! 属性
!
! Chrome
!
! Internet Explorer / Edge
!
! Firefox
!
! Safari
!
! Opera
|-
|-
| white-space
| white-space

2022年8月19日 (五) 04:29的版本

CSS white-space 属性

规定段落中的文本不进行换行:


示例

p
{
    white-space:nowrap;
}

属性定义及使用说明

white-space属性指定元素内的空白怎样处理。

默认值: normal
继承: yes
版本: CSS1
JavaScript 语法: object.style.whiteSpace="pre"

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

属性 Chrome Internet Explorer / Edge Firefox Safari Opera
white-space 1.0 5.5 3.5 3.0 9.5

属性值

描述
normal 默认。空白会被浏览器忽略。
pre 空白会被浏览器保留。其行为方式类似 HTML 中的 <pre> 标签。
nowrap 文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。
pre-wrap 保留空白符序列,但是正常地进行换行。
pre-line 合并空白符序列,但是保留换行符。
inherit 规定应该从父元素继承 white-space 属性的值。

相关文章

CSS 教程: CSS Text

此页面最后编辑于2022年8月19日 (星期五) 04:29。