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. 详解使用flask_paginate进行分页

    分页技术好处: 1.分页技术是把数据全部查询出来,然后再进行分页 2.分页技术可以,降低带宽使用,提高访问速度 使用flask_paginate进行分页 1.要使用flask_paginate,首先安 ...

  2. 微信 JS-SDK 签名验证

    doc: http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html demo:http://demo.open.weix ...

  3. spring mvc 数据格式化

    web.xml <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www. ...

  4. Windows下的Jdk 1.8*安装并配置(图文详解)

    不多说,直接上干货! 简单说下,jdk1.8*的下载,见http://www.cnblogs.com/zlslch/p/5658383.html 双击jdk-8u60-windows-x64.exe运 ...

  5. SOA和微服务架构的区别?

    转自知乎:https://www.zhihu.com/question/37808426/answer/93335393 SOA和微服务架构的区别? 微服务架构强调的第一个重点就是业务系统需要彻底的组 ...

  6. spring mvc requestmapping 配置多个

    参考 import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation. ...

  7. 【LeetCode题解】347_前K个高频元素(Top-K-Frequent-Elements)

    目录 描述 解法一:排序算法(不满足时间复杂度要求) Java 实现 Python 实现 复杂度分析 解法二:最小堆 思路 Java 实现 Python 实现 复杂度分析 解法三:桶排序(bucket ...

  8. React 基础实例教程

    园子都荒废两个月了,实在是懒呀.. 近段时间用React开发了几个页面,在使用过程中着实碰到了一些问题,估计刚开始学习的伙伴们都会遇到各种各样的坑 总结记录一下,只看文档是碰不上问题的,内容基础也不基 ...

  9. IIS 共享目录读写报错 Access to the path:“\\192.168.0.1\1.txt”is denied解决方案

    这个是IIS权限的问题,主要修改了以下地方,如果两台电脑有相同的用户名和密码可以跳过第一步 1.找到共享目录的文件夹,属性=>共享,给电脑创建一个新用户,共享文件下添加新用户的读写权限,然后对应 ...

  10. es6学习笔记12--Class

    Class基本语法 概述 JavaScript语言的传统方法是通过构造函数,定义并生成新对象.下面是一个例子. function Point(x,y){ this.x = x; this.y = y; ...