Tipografi dikontrol dening kulawarga properti font-* lan text-*. Nyetel sing bener iku kebanyakan sing nggawe halaman katon rapi lan bisa dibaca.
{
: , system-ui, sans-serif;
: ;
: ;
: italic;
: ;
: ;
}
font-family: "Inter", system-ui, -apple-system, sans-serif;
Browser nyoba saben siji miturut urutan nganti ana sing kasedhia. Selalu ngetutup karo kulawarga generik (sans-serif, serif, monospace) supaya teks bisa diperake sanajan font khusus gagal. system-ui nggunakake font asli OS (cepet, ora ana download).
.text {
text-align: center; /* left | right | center | justify */
text-decoration: underline;/* underline | line-through | none */
text-transform: uppercase; /* UPPERCASE | lowercase | Capitalize */
white-space: nowrap; /* prevent wrapping */
word-break: break-word; /* break long words/URLs */
}
line-height: 1.5; /* ✅ 1.5 × the element's font-size — scales correctly */
line-height: 24px; /* ⚠️ fixed — doesn't adapt if font-size changes */
line-height tanpa unit ngalike ukuran font saben elemen, supaya tetep proporsional nalika elemen sing nested duwe ukuran beda — cara sing direkomendasikan.
.truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; /* shows "..." when text is cut off */
}
Propertyti teks nglayani readabilitas lan hierarki visual — font-size/weight kanggo penekanan, line-height (~1.5) kanggo mbacane nyaman, fallback stacks kanggo reliability, lan text-overflow kanggo pemotongan sing resik.
Tipografi sing apik iku sebagian besar UI sing katon apik.