Tabel HTML: Membuat Tabel HTML Pertama Anda

Penjelasan Singkat Mengenai Tabel HTML

  • Sebuah tabel pada HTML didefinisikan menggunakan tag <table> , dan mengandung table cells<td>, singkatan dari “table data” ) yang berada di dalam tag table rows ( <tr>). Kode HTML untuk tabel adalah selalu berdasarkan baris terlebih dahulu, bukan kolom.
  • Table cells yang berada di baris paling atas atau header row ditulis menggunakan tag <th> (table header).
  • Table cells dapat digabung (merge) menggunakan tag colspan dan rowspan.
  • Tabel dapat dibagi menjadi tiga bagian sebagai berikut :
    • <thead> — Table header
    • <tbody> — Table body
    • <tfoot> — Table footer
  • Sebuah caption dapat ditambahkan ke dalam sebuah tabel menggunakan tag <caption>.
  • Anda dapat menggunakan <col> dan <colgroup> untuk membuat kolom tabel untuk keperluan desain.
  1. Contoh Tabel Sederhana

    Ini adalah sebuah contoh tabel HTML yang sangat sederhana. Copy kode ini di editor Anda, lalu jalankan di browser. Jika anda belum memiliki editor untuk pemrograman, silahkan cek post saya tentang Top 5 PHP Editor (IDE) untuk Pemrograman Web.

    <table>
    	<tr>
    		<th>Name</th>
    		<th>Favorite Color</th>
    	</tr>
    	<tr>
    		<td>Bob</td>
    		<td>Yellow</td>
    	</tr>
    	<tr>
    		<td>Michelle</td>
    		<td>Purple</td>
    	</tr>
    </table>

  2. Contoh Tabel HTML Kompleks

    <table>
      <caption>A complex table</caption>
      <thead>
        <tr>
          <th colspan="3">Invoice #123456789</th>
          <th>14 January 2025
        
        </tr>
        <tr>
          <td colspan="2"><strong>Pay to:</strong><br> Acme Billing Co.<br> 123
            Main St.<br> Cityville, NA 12345</td>
          <td colspan="2"><strong>Customer:</strong><br> John Smith<br> 321
            Willow Way<br> Southeast Northwestershire, MA 54321</td>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th>Name / Description</th>
          <th>Qty.</th>
          <th>@</th>
          <th>Cost</th>
        </tr>
        <tr>
          <td>Paperclips</td>
          <td>1000</td>
          <td>0.01</td>
          <td>10.00</td>
        </tr>
        <tr>
          <td>Staples (box)</td>
          <td>100</td>
          <td>1.00</td>
          <td>100.00</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <th colspan="3">Subtotal</th>
          <td>110.00</td>
        </tr>
        <tr>
          <th colspan="2">Tax</th>
          <td>8%</td>
          <td>8.80</td>
        </tr>
        <tr>
          <th colspan="3">Grand Total</th>
          <td>$ 118.80</td>
        </tr>
      </tfoot>
    </table>

Yang Dapat Kita Kembangkan Dengan Tabel HTML

Bootstrap adalah sebuah template CSS untuk membuat tabel HTML anda memiliki tampilan yang lebih baik. Hanya dengan memuatnya di halaman HTML Anda menggunakan tag <link>, Anda tinggal menggunakannya menggunakan class yang telah disediakan oleh Bootstrap. Contohnya, Anda dapat dengan mudah mengganti warna tabel, membuat warna selang seling pada baris tabel, membuat tabel tanpa garis dengan desain yang elegan, baris tabel yang dapat menyala ketika kursor melewatinya, dan masih banyak lagi. Coba sendiri kode Bootstrap Anda dengan membaca documentation tentang Bootstrap Table di sini.

Tabel yang ada pada halaman ini juga masih merupakan tabel statik, artinya datanya langsung diketikkan pada kode program. Ketika membuat tabel di sebuah website, pada umumnya kita memerlukan data yang dinamis, misalnya kita ambil data tersebut dari sebuah database. Pada postingan selanjutnya akan saya jelaskan bagaimana membuat tabel yang dinamis menggunakan PHP dan HTML.

871 comments

  1. more info here clipsit

    Im impressed, I have to say. Really not often do I encounter a weblog thats both educative and entertaining, and let me let you know, you may have hit the nail on the head. Your concept is excellent; the difficulty is one thing that not enough persons are talking intelligently about. I’m very glad that I stumbled throughout this in my search for one thing referring to this.

  2. check it out clipsit pearltrees

    excellent post, very informative. I wonder why the other experts of this sector don’t notice this. You should continue your writing. I am sure, you’ve a huge readers’ base already!

  3. official site pearltrees.com

    There’s noticeably a bundle to find out about this. I assume you made sure good factors in options also.

  4. clipsit jerrys product reviews

    There is noticeably a bundle to find out about this. I assume you made certain nice factors in features also.

  5. tours and travels

    hello!,I really like your writing very a lot! percentage we keep up a correspondence extra about your article on AOL? I need an expert on this area to unravel my problem. May be that is you! Taking a look forward to peer you.

  6. clipsitnet twitter.com

    Oh my goodness! a tremendous article dude. Thanks Nonetheless I’m experiencing difficulty with ur rss . Dont know why Unable to subscribe to it. Is there anybody getting equivalent rss problem? Anyone who knows kindly respond. Thnkx

  7. twitter.com

    When I originally commented I clicked the -Notify me when new feedback are added- checkbox and now every time a comment is added I get 4 emails with the identical comment. Is there any approach you can remove me from that service? Thanks!

  8. mini blinds

    Hello There. I found yoyr blog using google.This is an extremely well written article.
    I’ll make sure to bookmark iit and return to read more of your useful information. Thanks for the post.
    I’ll certainly return.

  9. twitter.com

    This web site is known as a walk-by means of for all of the information you wanted about this and didnt know who to ask. Glimpse right here, and youll undoubtedly discover it.

  10. catering dieteryczny krakow

    I don?t even know how I ended up here, but I thought this post was great. I do not know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

  11. kontakty antybakteryjne

    I was suggested this website by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my problem. You are amazing! Thanks!

  12. judi slot online

    We found your publish and pays to for all. With thanks

  13. situs slot

    Hmm, it appears to be like the site ate my initial comment (it was really long) so I speculate I’ll just sum that up the things my partner and i had written and claim, I’m thoroughly enjoying the blog. I as effectively is an aspiring website writer, but I’m even now new to the complete thing. Do you possess any tips for newbie blog page copy writers? I’d appreciate it.

  14. Kuchnie Bielsko

    Hey There. I found your blog using msn. This is a really well written article. I?ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will definitely comeback.

  15. dugouts

    commercial playground equipment workout

  16. judi slot

    Hello! Ive been like your site for some epoch now due to its awesome content.Just wanted to suggestion keep taking place the fine job!

  17. Bluebird amex activation

    The subsequent time I learn a blog, I hope that it doesnt disappoint me as a lot as this one. I mean, I do know it was my choice to learn, however I truly thought youd have one thing fascinating to say. All I hear is a bunch of whining about something that you might repair when you werent too busy in search of attention.

  18. Mellissa

    Hello exceptional website! Does running a blog like this require a large amount of work?
    I have very little expertise in programming but I was hoping to start my own blog in the near future.
    Anyways, if you have any recommendations or tips for new blog owners please share.
    I know this is off topic however I just had to ask. Appreciate it!

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *