CSS text 文本样式

CSS text 文本样式,第1张

CSS text 文本样式

CSS text 文本样式


text formatting

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 from the "尝试一下" link.


CSS text 文本颜色

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

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

  • 十六进制值 - 如"#FF0000"

  • 一个RGB值 - "RGB(255,0,0)"

  • 颜色的名称 - 如"红"

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

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

实例

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

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


CSS文本对齐

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

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

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

实例

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


CSS文本修饰

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

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

实例

a {text-decoration:none;}

也可以这样装饰文字:

实例

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

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


CSS文本转换

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

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

实例

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


CSS文本缩进

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

实例

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设置字间距

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/3012210.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-09-28
下一篇 2022-09-28

发表评论

登录后才能评论

评论列表(0条)

保存