当前位置:首页 > 教程 > CSS > CSS文本

3.3 CSS文本转换(大小写字母)

text-transform 属性控制文本的大小写。

描述
none 默认。定义带有小写字母和大写字母的标准的文本。
capitalize 文本中的每个单词以大写字母开头。
uppercase 定义仅有大写字母。
lowercase 定义无大写字母,仅有小写字母。

举例:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>3.3 CSS文本转换(大小写字母)</title>
    </head>
    <style>
        .capitalize {
            text-transform: capitalize;
            /*每个单词的首字母为大写*/
        }

        .uppercase {
            text-transform: uppercase;
            /*大写字母*/
        }

        .lowercase {
            text-transform: lowercase;
            /*小写字母*/
        }
    </style>
    <body>
        <p class="capitalize">That man is the richest whose pleasure are the cheapest.</p>
        <p class="uppercase">Will, work and wait are the pyramidal cornerstones for success.</p>
        <p class="lowercase">All the splendor in the world is not worth a good friend.</p>
    </body>
</html>

运行后如图:

3.3 CSS文本转换(大小写字母)

你觉得文章内容怎么样

阿里云代金券 100 云产品通用

有效期30天 首购用户

立即领取
推荐宝塔面板 0 安全高效的

服务器运维面板

立即领取