css文本显示方式,CSS 文本

通过使用CSS,我们可以控制文本样式。例如,我们可以更改文本颜色,我们可以控制文本对齐,缩进,字母间距等。

文本颜色

color属性设置文本的颜色。

我们可以使用以下方式指定颜色。HEX值 - 如“#ff00ee”

RGB值 - 如“rgb(255,0,255)”

颜色名称 - 如“红色”

以下代码将标题1设置为红色。h1 {

color: red;

}

文本对齐

text-align指定文本块的对齐方式

它的可能值是:start end left right center justify。

以下代码显示应用于文本块的text-align属性。p#left {

text-align: left;

}

p#center {

text-align: center;

}

p#right {

text-align: right;

}

p#justify {

text-align: justify;

}

文本修饰

text-decoration对文本块应用修饰,如下划线。

其可能的值为:none underline overline line-through blink。

默认值为none,不应用修饰。

以下代码显示如何使用text-decoration和text-transform属性。p {

text-decoration: line-through;

text-transform: uppercase;

}

p.one {

text-decoration: underline;

}

p.two {

text-decoration: overline;

}

p.three {

text-decoration: line-through;

}

p.four {

text-decoration: underline overline line-through;

}

文本变换

text-transform将变换应用于文本块。

其可能的值为:none capitalize uppercase lowercase。

默认值为none。

以下代码显示如何使用text-decoration和text-transform属性。span.lower {

text-transform: lowercase;

}

span.upper {

text-transform: uppercase;

}

span.capitalize {

text-transform: capitalize;

}

span.example {

background: pink;

}

相关属性

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值