Diskon kelas baru hingga 25%! Masukkan kupon "lebihcepat" di kelas ini

X
Logo Koala Skodev mengetik

Skodev

Belajar coding dalam bahasa Indonesia

TEXT ALIGN PADA CSS

Meratakan text pada CSS menggunakan text-align, untuk membuat elemen rata kiri, tengah atau kanan

Kita bisa meratakan sebuah text ke kiri (default), tengah atau kanan dengan bantuan properti text-align

Contoh penggunaan text-align

Berikut contoh meratakan text

<p style="text-align:left;"> Saya rata kiri </p>
<p style="text-align:center;"> Saya rata tengah </p>
<p style="text-align:right;"> Saya rata kanan </p>

Saya rata kiri

Saya rata tengah

Saya rata kanan

Align Justify

Bagaimana dengan justify? atau menyebarkan text dengan rata hingga baris akhir, yang biasanya digunakan pada text yang memenuhi lebar?

<p style="text-align:justify;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset she
</p>

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset she

Bandingkan dengan yang tidak menggunakan text-align:justify

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset she

👈🏼 Warna text pada CSS
Text decoration pada CSS 👉🏼