目录

text-transform

描述 (Description)

text-transform属性更改元素中文本的大小写,或者指示用户代理“按原样”保留大小写。

可能的值 (Possible Values)

  • capitalize - 元素文本中每个单词的第一个字母应该大写。

  • uppercase - 元素文本中的所有字符都应为大写(大写字母)。

  • lowercase - 元素文本中的所有字符都应为小写。

  • none - 不应更改元素文本的大小写。

适用于 (Applies to)

所有HTML元素。

DOM语法 (DOM Syntax)

object.style.textTransform = "uppercase";

例子 (Example)

以下示例演示如何使用text-transform属性设置文本的大小写。

<html>
   <head>
   </head>
   <body>
      <p <b class="notranslate">style = "text-transform:capitalize;"</b>>
         This will be capitalized
      </p>
      <p <b class="notranslate">style = "text-transform:uppercase;"</b>>
         This will be in uppercase
      </p>
      <p <b class="notranslate">style = "text-transform:lowercase;"</b>>
         This will be in lowercase
      </p>
   </body>
</html> 

这将产生以下结果 -

新页面打开
↑回到顶部↑
WIKI教程 @2018