使用 CSS 将文本转换为小写


要使用 CSS 将文本转换为小写,我们将使用 text-transform 属性的小写值。

示例

在此示例中,我们使用了 **text-transform** 属性,并使用 p 标记显示转换前后的结果。

<html>
<head>
    <style>
        #lcase{
            text-transform:lowercase;
        }
    </style>
</head>
<body>
    <h3>
        Convert Text to Lowercase with CSS
    </h3>
    <p>
        In this example we have used <strong>text-
        transform</strong> property to convert the 
        text to lowercase.
    </p>
    <hr>
    <p>This is a NORMAL text with Mixed CASes.</p>
    <h4>After Conversion to Lower Case:</h4>
    <p id="lcase">
        This is a NORMAL text with lower CASe.
    </p>
</body>
</html>

结论

为了在本文中使用 CSS 将文本转换为小写,我们使用了 **text-transform** 属性。仅在使用 CSS 时,我们才有此方法可用。

更新于:2024 年 9 月 11 日

3K+ 浏览量

开启你的职业生涯

完成课程获得认证

开始
广告
© . All rights reserved.