Jun 29, 2010

Buat Table Dalam Pos


PIALA DUNIA 2010 AFRIKA SELATAN
26/06/10 Uruguay 2:1 Korea Selatan
27/06/10 Ghana 2:1 USA
27/06/10 Jerman 4:1 England
28/06/10 Argentina 3:1 Mexico
28/06/10 Belanda 2:1 Slovakia
29/06/10 Brazil 3:0 Chile
Contoh Table 1

Seblum buat kod untuk Contoh Table 1, kena masukkan dulu dalam pos dia punya kod CSS seperti berikut:


<style type="text/css">
table.contoh1 {
width: 500px;
background-color: #fafafa;
border: 5px #000000 solid;
margin-left: 15px;
font-size: small;
font-weight: bold;
border-style: inset;
}

td.hed {
background-color: #666;
border: 2px #000000 solid;
font-family: Trebuchet MS, Verdana;
font-size: small;
font-weight: bold;
text-align: center;
color: #fff;
padding: 5px;
border-style: inset;
}

td.date {
width: 20%;
background-color: #99CCCC;
border: 2px #000000 solid;
font-family: Trebuchet MS, Verdana;
font-size: small;
font-weight: bold;
text-align: center;
padding: 5px;
color: #404040;
border-style: inset;
}

td.team1 {
width: 35%;
background-color: #99CCCC;
border: 2px #000000 solid;
font-family: Trebuchet MS, Verdana;
font-size: small;
font-weight: bold;
text-align: right;
padding: 5px;
color: #404040;
border-style: inset;
}

td.score {
width: 10%;
background-color: #99CCCC;
border: 2px #000000 solid;
font-family: Trebuchet MS, Verdana;
font-size: small;
font-weight: bold;
text-align: center;
padding: 5px;
color: #404040;
border-style: inset;
}

td.team2 {
width: 35%;
background-color: #99CCCC;
border: 2px #000000 solid;
font-family: Trebuchet MS, Verdana;
font-size: small;
font-weight: bold;
text-align: left;
padding: 5px;
color: #404040;
border-style: inset;
}

.nobr br {
display: none
}
</style>


Selepas masukkan kod CSS> di atas baru buat kod untuk Contoh Table 1 seperti berikut:


<div class="nobr">
<table class="contoh1" cellspacing="5" cellpadding="0"><tbody>

<tr>

<td class="hed" colspan="4">PIALA DUNIA 2010 AFRIKA SELATAN</td>
</tr>

<tr>
<td class="date">26/06/10</td>
<td class="team1">Uruguay <img src="http://lh4.ggpht.com/_AkrTrvrxAwY/TCn9TnQoHLI/AAAAAAAAAr8/fQq8De0omrc/s800/Uruguay.jpg" /></td>
<td class="score">2:1</td>
<td class="team2"><img src="http://lh4.ggpht.com/_AkrTrvrxAwY/TCn9l5rvk5I/AAAAAAAAAsA/0k02DSl9nFM/s800/Korea.jpg" /> Korea Selatan</td>
</tr>

<tr>
<td class="date">27/06/10</td>
<td class="team1">Ghana <img src="http://lh3.ggpht.com/_AkrTrvrxAwY/TCn91ZhMT2I/AAAAAAAAAsE/YVgOXeIT5XE/s800/Ghana.jpg" /></td>
<td class="score">2:1</td>
<td class="team2"><img src="http://lh5.ggpht.com/_AkrTrvrxAwY/TCn-BymE_VI/AAAAAAAAAsI/QUNmGDBBckQ/s800/usa.jpg" /> USA</td>
</tr>

<tr>
<td class="date">27/06/10</td>
<td class="team1">Jerman <img src="http://lh5.ggpht.com/_AkrTrvrxAwY/TCn787D4a8I/AAAAAAAAAr0/sgmsTFiZdWM/s800/Germany.jpg" /></td<
<td class="score">4:1</td>
<td class="team2"><img src="http://lh3.ggpht.com/_AkrTrvrxAwY/TCn787JaFKI/AAAAAAAAArw/x3KBmd5LXyY/s800/England.jpg" /> England</td>
</tr<

<tr>
<td class="date">28/06/10</td>
<td class="team1">Argentina <img src="http://lh5.ggpht.com/_AkrTrvrxAwY/TCn78poBdKI/AAAAAAAAArk/duJsSEI2VQc/s800/Argentina.jpg" /></a></td>
<td class="score">3:1</td>
<td class="team2"><img src="http://lh4.ggpht.com/_AkrTrvrxAwY/TCn-Tqu0d5I/AAAAAAAAAsM/cVvIJOdRr4E/s800/Mexico.jpg" /> Mexico</td>
</tr>

<tr>
<td class="date">28/06/10</td>
<td class="team1">Belanda <img src="http://lh4.ggpht.com/_AkrTrvrxAwY/TCn-gxgnobI/AAAAAAAAAsQ/HxXpu3BA5IM/s800/Netherland.jpg" /></td>
<td class="score">2:1</td>
<td class="team2"><img src="http://lh6.ggpht.com/_AkrTrvrxAwY/TCn-s3ehYVI/AAAAAAAAAsU/aJE-BtiuGaE/s800/Slovakia.jpg" /> Slovakia</td>
</tr>

<tr>
<td class="date">26/06/10</td>
<td class="team1">Brazil <img src="http://lh4.ggpht.com/_AkrTrvrxAwY/TCn78g6ILpI/AAAAAAAAAro/kunmUhnPOGY/s800/Brazil.jpg" /></td>
<td class="score">3:0</td>
<td class="team2"><img src="http://lh5.ggpht.com/_AkrTrvrxAwY/TCn784XsPtI/AAAAAAAAArs/QKa2NYkRU5I/s800/Chile.jpg" /> Chile</td>
</tr>

</tbody></table></div>
<span style="font-size: small; padding-left: 15px;">Contoh Table 1</span>




2. Contoh Table 2:

T A J U K T A B L E
1.Sel duaSel tigaSel empatSel lima
2.Sel duaSel tigaSel empatSel lima
3.Sel duaSel tigaSel empatSel lima
4.Sel duaSel tigaSel empatSel lima
5.Sel duaSel tigaSel empatSel lima
Contoh Table 2

2.1 Sebelum buat Contoh Table 2, masukkan kod CSS untuk table ini dalam pos blog seperti berikut:

<style type="text/css">
table.contoh2 {
width: 500px;
border: 1px #000000 solid;
margin-left: 15px;
font-size: small;
font-weight: bold;
border-style: inset;
}

td.tajuk {
border: 1px #000000 solid;
font-family: Trebuchet MS, Verdana;
font-size: small;
font-weight: bold;
text-align: center;
padding: 8px;
border-style: inset;
}

td.kolom {
width: 20%;
border: 1px #000000 solid;
font-family: Trebuchet MS, Verdana;
font-size: small;
font-weight: bold;
text-align: center;
padding: 5px;
border-style: inset;
}
</style>


2.2 Lepas itu baru masukkan kod untuk Contoh Table 2 seperti berikut:

<table cellpadding="0" cellspacing="3" class="contoh2"><tbody>

<tr>
<td class="tajuk" colspan="5">T A J U K T A B L E</td>
</tr>

<tr>
<td class="kolom">1.</td>
<td class="kolom">Sel dua</td>
<td class="kolom">Sel tiga</td>
<td class="kolom">Sel empat</td>
<td class="kolom">Sel lima</td>
</tr>

<tr>
<td class="kolom">2.</td>
<td class="kolom">Sel dua</td>
<td class="kolom">Sel tiga</td>
<td class="kolom">Sel empat</td>
<td class="kolom">Sel lima</td>
</tr>

<tr>
<td class="kolom">3.</td>
<td class="kolom">Sel dua</td>
<td class="kolom">Sel tiga</td>
<td class="kolom">Sel empat</td>
<td class="kolom">Sel lima</td>
</tr>

<tr>
<td class="kolom">4.</td>
<td class="kolom">Sel dua</td>
<td class="kolom">Sel tiga</td>
<td class="kolom">Sel empat</td>
<td class="kolom">Sel lima</td>
</tr>

<tr>
<td class="kolom">5.</td>
<td class="kolom">Sel dua</td>
<td class="kolom">Sel tiga</td>
<td class="kolom">Sel empat</td>
<td class="kolom">Sel lima</td>
</tr>

</tbody></table>

<span style="font-size: 10px; font-weight: bold; padding-left: 15px;">Contoh Table 2</span>


2.3 Jika sekiranya kod CSS seperti contoh di atas tidak berfungsi dalam pos blog, kita terpaksa masukkan semua kod atau tag dalam CSS ini terus ke dalam kod table seperti berikut:

<table cellpadding="0" cellspacing="3" style="width: 500px; border: 1px #000000 solid; margin-left: 15px; font-size: 12px; font-weight: bold; border-style: inset;"><tbody>

<tr>
<td colspan="5" style="border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: small; font-weight: bold; text-align: center; padding: 8px; border-style: inset;">T A J U K    T A B L E</td>
</tr>

<tr>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">1.</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel dua</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel tiga</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel empat</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel lima</td>
</tr>

<tr>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">2.</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel dua</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel tiga</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel empat</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel lima</td>
</tr>

<tr>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">3.</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel dua</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel tiga</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel empat</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel lima</td>
</tr>

<tr>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">4.</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel dua</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel tiga</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel empat</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel lima</td>
</tr>

<tr>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">5.</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel dua</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel tiga</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel empat</td>
<td style="width: 20%; border: 1px #000000 solid; font-family: Trebuchet MS, Verdana; font-size: 12px; font-weight: bold; text-align: center; padding: 5px; border-style: inset;">Sel lima</td>
</tr>

</tbody></table>


2.4 Dengan contoh yang diberi diharap anda dapat menyediakan satu table dengan kandungan isinya yang sesuai dengan keperluan sendiri.


Sekian, selamat mencuba dan selamat berjaya.

Sebarang pautan balik dari blog anda adalah sangat-sangat dihargai. URL http://calipso-tutorialblogger.blogspot.com/.

Salam hormat dari

1 comments:

Mama2Q said... [Balas komen ini]

SALAM,saya mengambil contoh kod utk table 2, dan di situ ada 5 kolum, bagaimana mahu menambah kolum dan baris bawah supaya sesuai dengan keperluan saya..terima kasih atas tunjuk ajar..

Post a Comment