Skip to main content

文本

color#

三种方式

预定义值#

color:blue;

16进制#

color:#ff0000

RGB#

color:rgb(255,0,0);color: rgba(146, 50, 50, 0.65);/*rgba多一个参数,表示模糊程度

text-align#

文本在本行的对齐方式

left center right justify

text-align: center;

justify是两端对齐,可以让除最后一行之外的文字两端对齐,即每行的左右两端都紧贴行的边缘。

text-decoration#

装饰的意思

默认值是none

基本可选值:underline overline line-through

text-decoration: line-through;

可对基本值进行装饰,比如加上颜色,和线的种类

color line decoration 不分顺序

text-decoration: underline dotted red;

线主要有以下几种:

实线 solid

点线 dotted

双实线 double

波浪线 wavy

虚线dashed

基本线可以同时加多种不过,线要连着写,不然没用

 text-decoration: underline overline wavy red ; /*这个就是同时上下两条线*/

text-indent#

首航缩进,可以直接xxpx,最好是xxem,就是缩进多少个文字的大小,一般都是缩进2个,所以就2em

也可以使用30%这样来缩进,就是缩进一行width的百分比

text-indent: 50%;    text-indent: 30px;    text-indent: 2em;

text-shadow#

文字阴影

/* offset-x | offset-y | blur-radius | color */text-shadow: 1px 1px 2px black;

透明度opacity#

CSS 里的 opacity 属性用来设置元素的透明度。

属性值为 1 代表完全不透明。 属性值为 0.5 代表半透明。 属性值为 0 代表完全透明。

透明度会应用到元素内的所有内容,不论是图片,还是文本,或是背景色。

.links {    text-align: left;    color: black;    opacity:0.7;
  }

text-transform#

CSS 里的 text-transform 属性可以改变英文字母的大小写。 使用这个属性时,我们无需改变 HTML 元素中的文本也可以统一页面里英文的显示。

下面的表格展示了 text-transform 的不同值对文字 “Transform me” 的影响:

结果
lowercase"transform me"
uppercase"TRANSFORM ME"
capitalize"Transform Me"
initial使用默认值
inherit使用父元素的 text-transform 值。
noneDefault:不改变文字。