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

CSS实现英文或拼音单词首字母大写的更多相关文章

  1. javascript面试题:如何把一句英文每个单词首字母大写?

    上周看到大家在JS群讨论如何把一句英文句子单词收割字母大写,大家都说用正则简单,对于正则还是有点模糊,于是乎自己敲了下 //面试题:如何把一句英文每个单词首字母大写? var str="wh ...

  2. 小tips:JS/CSS实现字符串单词首字母大写

    css实现: text-transform:capitalize; JS代码一: String.prototype.firstUpperCase = function(){ return this.r ...

  3. string.capwords() 将每个单词首字母大写

    string.capwords() 将每个单词首字母大写 代码: import string s = ' The quick brown fox jumped over the lazy dog. ' ...

  4. 【Python实践-6】将不规范的英文名字,变为首字母大写,其他小写的规范名字

    #利用map()函数,把用户输入的不规范的英文名字,变为首字母大写,其他小写的规范名字. def f1(s): s=s.capitalize() return s list1= ['adam', 'L ...

  5. java String中的replace(oldChar,newChar) replace(CharSequence target,CharSequence replacement) replaceAll replaceFirst 面试题:输入英文语句,单词首字符大写后输出 char String int 相互转换

    package com.swift; import java.util.Scanner; public class FirstChat_ToCaps_Test { public static void ...

  6. Python 2:str.title()(使字符串每个单词首字母大写)

    name = "hello,world! hello,python!" print(name.title()) #单词首字母大写 运行结果将会是:Hello,World!Hello ...

  7. text-transform设置单词首字母大写

    text-transform 一.语法   text-transform 主要用于设置文本的大小写. text-transform有5个值,分别如下: none. 默认值. capitalize. 文 ...

  8. FCC JS基础算法题(4):Title Case a Sentence(句中单词首字母大写)

    题目描述: 确保字符串的每个单词首字母都大写,其余部分小写.像'the'和'of'这样的连接符同理. 算法: function titleCase(str) { // 转小写及分割成数组 var st ...

  9. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 排版:设定单词首字母大写

    <!DOCTYPE html> <html> <head> <title>菜鸟教程(runoob.com)</title> <meta ...

随机推荐

  1. Why does Http header contains "X-SourceFiles"?

    Question: Using a FileStreamResult in ASP.NET MVC 3, I get a response header like X-SourceFiles =?UT ...

  2. (转)Python: super 没那么简单

    原文:https://mozillazg.com/2016/12/python-super-is-not-as-simple-as-you-thought.html python 约定¶ 单继承¶ 多 ...

  3. python for dblp.xml

    由于最近处理数据时涉及到dblp.xml,刚开始下载时dblp.xml只有300多M,但解压之后就有1.9G,没有什么东西能够打开,所以必须要用工具来处理,在python中sax包能够一边解析一边处理 ...

  4. Javac中对import关键字进行的处理

    参考文章: (1)关于类的符号输入过程第二篇 ImportScope中存储的为ImportEntry,继承了Scope.Entry类并且多定义了个origin属性,也就是符号的最终来源.除此之外还对g ...

  5. idea @Override is not allowed when implementing interface method

    转自:http://blog.csdn.net/shenya2/article/details/50460447 在编码过程发现报错:@Override is not allowed when imp ...

  6. 复刻smartbits的国产网络性能测试工具minismb-如何配置Ping报文

    复刻smartbits的国产网络性能测试工具minismb,是一款专门用于测试智能路由器,网络交换机的性能和稳定性的软硬件相结合的工具.可以通过此以太网测试工具测试任何ip网络设备的端口吞吐率,带宽, ...

  7. Spring事务传播属性介绍(三).Nested

    Required.Required_New传播属性分析传送门:https://www.cnblogs.com/lvbinbin2yujie/p/10259897.html Mandatory.Neve ...

  8. 使用whiptail开发linux环境交互式对话框

    #!/bin/bash oem=$(/bin/cat /opt/jdwa/etc/oem) systype=$(/bin/cat /opt/jdwa/etc/systype) export selec ...

  9. 基于Hadoop2.6.5(HA)的HBase2.0.5配置

    1.配置 在CentOS7Three上配置,注意:一定要安装bin包,不能安装src包 /usr/local/hbase/hbase-2.0.5/conf 编辑hbase-env.sh,替换成如下配置 ...

  10. Java设计模式学习记录-单例模式

    前言 已经介绍和学习了两个创建型模式了,今天来学习一下另一个非常常见的创建型模式,单例模式. 单例模式也被称为单件模式(或单体模式),主要作用是控制某个类型的实例数量是一个,而且只有一个. 单例模式 ...