Sifat text-transform CSS

Definition and usage

The text-transform property controls the case of the text.

Description

This property changes the letter case of the letters in the element, regardless of the letter case of the text in the source document. If the value is capitalize, some letters must be capitalized, but it does not define how to determine which letters to capitalize, which depends on how the user agent identifies each 'word'.

See also:

CSS tutorial:Teks CSS

HTML DOM reference manual:textTransform property

Example

Convert text in different elements:

h1 {text-transform:uppercase;}
h2 {text-transform:capitalize;}
p {text-transform:lowercase;}

Try it yourself

Tips and notes

Note:Different user agents may use different methods to determine where a word starts, and accordingly determine which letters should be capitalized. For example, the text "w3-school" can be displayed in two ways: "W3-school" and "W3-School". CSS does not specify which one is correct, so both are acceptable.

CSS grammar

text-transform: none|capitalize|uppercase|lowercase|initial|inherit;

Attribute value

Value Description
none Default. Defines standard text with lowercase and uppercase letters.
capitalize Each word in the text starts with a capital letter.
uppercase Define with only capital letters.
lowercase Define without capital letters, only lowercase letters.
inherit Itu diatur untuk mendapatkan nilai text-transform dari elemen induk.

Technical details

Default value: none
Inheritance: yes
Versi: CSS1
JavaScript grammar: object

contoh lebih banyak

awasi huruf kapital dan huruf kecil di dalam teks
contoh ini menunjukkan bagaimana mengawasi besaran huruf kapital dan huruf kecil dalam teks.

kepatuhan browser

angka di dalam tabel menunjukkan versi pertama browser yang mendukung atribut ini penuh.

Chrome IE / Edge Firefox Safari Opera
1.0 4.0 1.0 1.0 7.0