如何使用css中text-transform轉換字母大小寫樣本詳解

來源:互聯網
上載者:User
以前我們都是用JS來實現字母的首字母大小寫,但現在沒有必要了,CSS完全可以實現,話說相容性還好從IE6開始就支援了。

text-transform:none | capitalize | uppercase | lowercase

none:

無轉換

capitalize:

將每個單詞的第一個字母轉換成大寫

<style>  #box{    text-transform:capitalize;  }</style><p id="box">css javascript html5</p>
uppercase:

將每個單詞轉換成大寫

#box{  text-transform:uppercase;}<p id="box">css javascript html5</p>
lowercase:

將每個單詞轉換成小寫

#box{  text-transform:lowercase;}<p id="box">CSS JAVASCRIPT HTML5</p>

實在是太簡單了,都不好多說什麼。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.