CSS Text文本格式

Text Color

颜色属性被用来设置文字的颜色。

颜色是通过CSS最经常的指定:

  • 十六进制值 - 如"#FF0000"
  • 一个RGB值 - "RGB(255,0,0)"
  • 颜色的名称 - 如"红"

参阅 CSS 颜色值 查看完整的颜色值。

一个网页的背景颜色是指在主体内的选择:

实例

body {color:blue;}
h1 {color:#00ff00;}
h2 {color:rgb(255,0,0);}

尝试一下 »

 对于W3C标准的CSS:如果你定义了颜色属性,你还必须定义背景色属性。


文本的对齐方式

文本排列属性是用来设置文本的水平对齐方式。

文本可居中或对齐到左或右,两端对齐.

当text-align设置为"justify",每一行被展开为宽度相等,左,右外边距是对齐(如杂志和报纸)。

实例

h1 {text-align:center;}
p.date {text-align:right;}
p.main {text-align:justify;}

尝试一下 »


文本修饰

text-decoration 属性用来设置或删除文本的装饰。

从设计的角度看 text-decoration属性主要是用来删除链接的下划线:

实例

a {text-decoration:none;}

尝试一下 »

也可以这样装饰文字:

实例

h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}

尝试一下 »

 我们不建议强调指出不是链接的文本,因为这常常混淆用户。


文本转换

文本转换属性是用来指定在一个文本中的大写和小写字母。

可用于所有字句变成大写或小写字母,或每个单词的首字母大写。

实例

p.uppercase {text-transform:uppercase;}
p.lowercase {text-transform:lowercase;}
p.capitalize {text-transform:capitalize;}

尝试一下 »


文本缩进

文本缩进属性是用来指定文本的第一行的缩进。

实例

p {text-indent:50px;}

尝试一下 »



更多实例

指定字符之间的空间
这个例子演示了如何增加或减少字符之间的空间。

指定行与行之间的空间
这个例子演示了如何指定在一个段落中行之间的空间

设置元素的文本方向
这个例子演示了如何改变元素的文本方向。

增加单词之间的空白空间
这个例子演示了如何增加一个段落中的单词之间的空白空间。

在元素内禁用文字环绕
这个例子演示了如何禁用一个元素内的文字环绕。

垂直对齐图像
这个例子演示了如何设置文本的垂直对齐图像。

添加文本阴影
这个例子演示了如何设置文本阴影。


所有CSS文本属性。

属性 描述
color 设置文本颜色
direction 设置文本方向。
letter-spacing 设置字符间距
line-height 设置行高
text-align 对齐元素中的文本
text-decoration 向文本添加修饰
text-indent 缩进元素中文本的首行
text-shadow 设置文本阴影
text-transform 控制元素中的字母
unicode-bidi  
vertical-align 设置元素的垂直对齐
white-space 设置元素中空白的处理方式
word-spacing 设置字间距
时间: 2024-08-28 13:39:01

CSS Text文本格式的相关文章

pdftotext —— Linux/Unix中将PDF文件转化为Text文本格式的利器

安装 pdftotext 到 RedHat / RHEL / Fedora / CentOS / Ubuntu 在不同的Linux分发版本中使用poppler-utils包安装pdftotext(CentOS): # yum install poppler-utils 或者在Debian / Ubuntu中使用如下指令: $ sudo apt-get install poppler-utils pdftotext 使用语法 pdftotext {PDF-file} {text-file} 如何将

PHP全栈开发(八):CSS Ⅳ 文本格式属性(text)

文本系列属性主要是设置文本格式的,例如.... 颜色 body {color:red;} h1 {color:#00ff00;} p.ex {color:rgb(0,0,255); 可以设置文本的居中,左对齐,右对齐,两端对齐等,使用text-align属性 h1 {text-align:center;} p.date {text-align:right;} p.main {text-align:justify;} justify属性表示两端对齐 还有设置文本的删除线.下划线.或者删除文本的下划

CSS(3) Text(文本)

一.CSS文本格式 1.Text Color 颜色属性被用来设置文字的颜色.颜色是通过CSS最经常的指定:十六进制值 - 如"#FF0000":一个RGB值 - "RGB(255,0,0)":颜色的名称 - 如"红" 一个网页的背景颜色是指在主体内的选择: body {color:blue;} h1 {color:#00ff00;} h2 {color:rgb(255,0,0);} 2.文本的对齐方式 文本排列属性是用来设置文本的水平对齐方式.文

雷林鹏分享:CSS 文本格式

文本格式 This text is styled with some of the text formatting properties. The heading uses the text-align, text-transform, and color properties. The paragraph is indented, aligned, and the space between characters is specified. The underline is removed f

CSS 文本格式

CSS 文本格式 文本格式 This text is styled with some of the text formatting properties. The heading uses the text-align, text-transform, and color properties. The paragraph is indented, aligned, and the space between characters is specified. The underline is

CSS 文本格式:对齐方式、文本修饰、文本转换、文本缩进

CSS 文本格式 文本颜色 颜色属性被用来设置文字的颜色. 颜色是通过CSS最经常的指定: 十六进制值 - 如: #FF0000 一个RGB值 - 如: RGB(255,0,0) 颜色的名称 - 如: red 参阅 CSS 颜色值 查看完整的颜色值. 一个网页的背景颜色是指在主体内的选择: 实例 body{color:red;}h1{color:#00ff00;}h2{color:rgb(255,0,0);} 对于W3C标准的CSS:如果你定义了颜色属性,你还必须定义背景色属性. 文本的对齐方式

css(文本格式化,文本格式处理)

文本格式化,文本格式处理 文本格式化 1.控制字体 1.指定字体 font-family:"microsoft yahei",arial,"宋体"; 2.字体大小 font-size: px , pt 作为单位  30pt  16pt 常用字体大小:12px - 14px 3.字体加粗 相当于 <b></b> font-weight : normal / bold ; 建议:通过 该属性取代 b 标签 4.字体样式 斜体 font-style

VBA 以文本格式打开DSV

Public Function GetDataFromDSV(fpath As String) As Collection Dim AllTextFormat(255) As Integer Dim i As Long For i = 0 To 255 AllTextFormat(i) = xlTextFormat Next i Application.ScreenUpdating = False Application.DisplayAlerts = False Application.Wor

css实现文本超出li宽度的部分隐藏

css实现文本超出li宽度的部分隐藏:在某些实际应用中,希望把文本超出的部分隐藏而非换行,下面就是一段这样的代码实例,大家可以参考一下.代码如下: <!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title&