Home > Web Front-end > CSS Tutorial > How Can I Capitalize the First Letter of Each Word in a Label Using CSS?

How Can I Capitalize the First Letter of Each Word in a Label Using CSS?

Patricia Arquette
Release: 2024-12-07 18:45:13
Original
744 people have browsed it

How Can I Capitalize the First Letter of Each Word in a Label Using CSS?

Capitalizing the Initial Character in CSS

Is it possible to capitalize the first character in a label using CSS?

HTML Sample

<a class="m_title" href="">gorr</a>
<a class="m_title" href="">trro</a>
<a class="m_title" href="">krro</a>
<a class="m_title" href="">yrro</a>
<a class="m_title" href="">gwwr</a>
Copy after login

CSS Solution

To achieve this, CSS provides the text-transform property:

a.m_title {
  text-transform: capitalize;
}
Copy after login

This property instructs the browser to capitalize the first character of each word within the m_title class.

Result

<a class="m_title" href="">Gorr</a>
<a class="m_title" href="">Trro</a>
<a class="m_title" href="">Krro</a>
<a class="m_title" href="">Yrr</a>
<a class="m_title" href="">Gwwr</a>
Copy after login

The above is the detailed content of How Can I Capitalize the First Letter of Each Word in a Label Using CSS?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template