CSS实现英文或拼音单词首字母大写

CSS实现英文或拼音单词首字母大写,只需要在css样式中加入:

text-transform: capitalize

即可。

测试代码如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>英文或拼音单词首字母大写</title>
<style>
.shou_daxie {
text-transform: capitalize
}
.quan_daxie {
text-transform: uppercase
}
.quan_xiaoxie {
text-transform: lowercase
}
</style>
</head> <body>
<div class="shou_daxie"> 首字母大写:&nbsp;&nbsp;the bus will depart at the scheduled time regardless of latecomers</div>
<div class="quan_daxie"> 字母全实现大写:&nbsp;&nbsp;tHe Bus wIll dePart at the scHeduled Time rEgardless of latecomers</div>
<div class="quan_xiaoxie"> 字母全实现小写:&nbsp;&nbsp;tHe Bus wIll dePart at the scHeduled Time rEgardless of latecomers</div>
</body>
</html>

结果如下:

首字母大写:  The Bus Will Depart At The Scheduled Time Regardless Of Latecomers
字母全实现大写: THE BUS WILL DEPART AT THE SCHEDULED TIME REGARDLESS OF LATECOMERS
字母全实现小写: the bus will depart at the scheduled time regardless of latecomers
上一篇:PHP的学习--使用phar打包


下一篇:RSVP协议的基本概念介绍