Thursday, March 31, 2016

HTML Background


HTML Background
HTML Background dibagi menjadi dua :
  • HTML Background dengan color/warna.
  • HTML Background dengan image/gambar.
HTML Background dengan warna
Misalkan kita memiliki kita ingin memberikan background warna pada elemen tabel :
<table>
<tr>
<td width="100" height="100">
</td>
</tr>
</table>
Maka kita tambahkan attribut bgcolor="red" pada tag seperti berikut :
<table bgcolor="red">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>
Buktikan sendiri :
Codingku HTML Editori
<table bgcolor="red">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>

Dengan CSS :

Kita tambahkan style="background-color:red" pada tag pembuka table.
<table style="background-color:red">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>
Buktikan sendiri :
Codingku HTML Editori
<table style="background-color:red">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>

HTML Background Image

Kita tetap akan menggunakan kode seperti di atas.

Tanpa CSS 


Kita tambahkah dalam tag <table> dengan background:"http://codingku.com/html/img/pattern.gif"
<table background="http://codingku.com/html/img/pattern.gif">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>
Codingku HTML Editori
<table background="http://codingku.com/html/img/pattern.gif">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>

Dengan CSS

<table style="background-image:url('http://codingku.com/html/img/pattern.gif')">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>

Buktikah :
Codingku HTML Editori
<table
style="background-image:url('http://codingku.com/html/img/pattern.gif')">
<tr>
<td width="100" height="100">
</td>
</tr>
</table>

0 komentar:

Post a Comment