Atribut HTML Style
Pengaturan
gaya/Styles elemen HTML dapat dilakukan dengan atribut style .
Atribut
style sintaks nya adalah
sebagai berikut :
<tagname style="property:value;">
properti adalah properti CSS. nilai adalah
nilai CSS.
Anda
akan belajar lebih banyak tentang CSS kemudian dalam tutorial ini.
Background Warna HTML
Properti
background-color mendefinisikan warna latar belakang untuk elemen HTML.
Contoh
ini menetapkan warna latar belakang powderblue untuk halaman.
Contoh :
<body style="background-color:powderblue;">
<h1>This is a heading</h1> <p>This is a paragraph.</p> </body> |
Warna Teks HTML
Properti
warna mendefinisikan warna teks untuk elemen HTML.
Contoh :
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p> |
HTML Font
Properti
font-family mendefinisikan font yang akan digunakan untuk elemen HTML.
Contoh :
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p> |
HTML Text Size
Properti
font-size mendefinisikan ukuran teks untuk elemen HTML
Contoh :
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p> |
HTML Penyelarasan Teks
Properti
text-align mendefinisikan perataan teks horisontal untuk elemen HTML
Contoh :
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p> |
Bab Ringkasan
- Style untuk elemen styling HTML
- Background-colour untuk warna background
- colour untuk warna teks
- font-family untuk font teks
- font-size untuk ukuran teks
- text-align untuk perataan teks