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. 【转】iOS中属性与成员变量的区别

    [转载自并整理 http://blog.csdn.net/itianyi/article/details/8618128] 一.类Class中的属性property 在ios第一版中,我们为输出口同时 ...

  2. Python--CSV模块

    CSV csv文件格式是一种通用的电子表格和数据库导入导出格式 简介 Python csv模块封装了常用的功能,使用的简单例子如下: 写入 # 写入csv文件 import csv csvfile = ...

  3. Shell常见的快捷键

    Ctrl + a - Jump to the start of the lineCtrl + b - Move back a charCtrl + c - Terminate the command ...

  4. iOS 8.0 bluetooth peripheral manager giving no callback for addService

    I am adding the service using: [self.peripheralManager addService:myService]; Is this method depreca ...

  5. windows平台安装php_memcache模块

    要求 必备知识 熟悉基本编程环境搭建. 运行环境 windows 7(64位);php-5.3; memcached-1.2.6 下载地址 环境下载 什么是PHP Memcache模块 Memcach ...

  6. 超漂亮的CSS3按钮制作教程分享

    要求 必备知识 基本了解CSS语法,初步了解CSS3语法知识. 开发环境 Adobe Dreamweaver CS6/Chrome浏览器 演示地址 演示地址 利用CSS3属性制作按钮,我们只需要用到G ...

  7. 基于Web Service的客户端框架搭建三:代理层(Proxy)

    前言 代理层的主要工作是调用Web Service,将在FCL层序列化好的Json数据字符串Post到Web Service,然后获得Reponse,再从响应流中读取到调用结果Json字符串,在Dis ...

  8. T-SQL触发器,限制一次只能删除一条数据

    /****** Object: Trigger [dbo].[trg_del] Script Date: 01/01/2016 12:58:28 ******/ SET ANSI_NULLS ON G ...

  9. AndroidStudio+ideasmali动态调试smali汇编

    0x00    前言 之前对于app反编译的smali汇编语言都是静态分析为主,加上一点ida6.6的动态调试,但是ida的调试smali真的像鸡肋一样,各种不爽,遇到混淆过的java代码就欲哭无泪了 ...

  10. a no-risk path to IEEE P1687

    You’ve heard all about IJTAG (IEEE P1687) [1,2,3], a new standard for accessing embedded test and 
d ...