Home  >  Article  >  Web Front-end  >  How to capitalize letters in css

How to capitalize letters in css

青灯夜游
青灯夜游Original
2021-05-13 14:06:3413916browse

You can use the text-transform attribute to set the capitalization of letters in css. The syntax format is "text-transform:capitalize|uppercase;"; the value "capitalize" can set the first letter to be capitalized, and the value "uppercase" can set the letters. All caps.

How to capitalize letters in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In CSS, you can use the text-transform attribute to set the capitalization of letters; the text-transform attribute controls the capitalization of text.

This attribute will change the case of letters in the element, regardless of the case of the text in the source document.

Attribute value:

Value Description
none default. Text that defines standards with lowercase and uppercase letters.
capitalize Every word in the text begins with a capital letter.
uppercase Definition only uppercase letters.
lowercase Definition has no uppercase letters, only lowercase letters.

Example: Set letter capitalization

<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<style type="text/css">
			h1 {
				text-transform: uppercase
			}
			
			p.uppercase {
				text-transform: uppercase
			}
			 
			
			p.capitalize {
				text-transform: capitalize
			}
		</style>
	</head>

	<body>
		<h1>This Is An H1 Element</h1>
		<p class="uppercase">This is some text in a paragraph.</p>
		<p class="capitalize">This is some text in a paragraph.</p>
	</body>

</html>

Rendering:

How to capitalize letters in css

Learning video sharing: css video tutorial

The above is the detailed content of How to capitalize letters in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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