Belajar Heading dalam HTML: Membuat Struktur Website dengan Mudah

Heading dalam HTML

Halo teman-teman!

Kita sudah membahas apa itu HTML di postingan sebelumnya. Kali ini, kita lanjut belajar dengan mempraktikkan salah satu elemen HTML paling penting, yaitu heading. Yuk, kita mulai!

Apa Itu Heading?

Dalam HTML, heading digunakan untuk memberi judul atau hierarki pada bagian-bagian website. Contohnya seperti di buku, heading itu seperti judul utama, subjudul, hingga bagian-bagian kecil dalam bab.

Heading dalam HTML dibuat menggunakan tag seperti <h1> hingga <h6>.

  • <h1>: Heading paling besar dan penting, biasanya digunakan untuk judul utama.
  • <h6>: Heading paling kecil, untuk detail atau subbagian.

Membuat Heading dalam HTML

Begini contoh penggunaan tag heading:

<h1>Hello World</h1>
  • Tag pembuka: <h1>
  • Tag penutup: </h1> (ingat, ada tanda garis miring / untuk menutup tag).
  • Konten: Teks yang diapit oleh tag, seperti "Hello World" di atas.

Perbedaan Tag dan Elemen

  • Tag: Bagian yang ada di dalam tanda < >. Contoh: <h1> atau </h1>.
  • Elemen: Gabungan tag pembuka, konten, dan tag penutup.

Contohnya:

<h1>Hello World</h1>

Seluruh bagian itu disebut elemen HTML.

Hierarki Heading

Heading dalam HTML mengikuti hierarki, seperti struktur tabel isi di buku:

  • <h1> untuk judul utama
  • <h2> untuk subjudul
  • <h3> hingga <h6> untuk bagian yang lebih detail

Contohnya:

<h1>Buku</h1>  
<h2>Bab 1</h2>  
<h3>Bagian 1.1</h3>  
<h4>Diagram</h4>  

Hasilnya di browser, heading dengan tag <h1> akan terlihat paling besar, sedangkan <h4> lebih kecil.

Tips Penting dalam Membuat Heading

  1. Gunakan Satu <h1> Saja
    Heading <h1> adalah judul utama. Tidak disarankan menggunakan lebih dari satu <h1> di halaman yang sama.

  2. Ikuti Urutan
    Pastikan urutan heading teratur. Jangan lompat-lompat, misalnya langsung dari <h1> ke <h3> tanpa <h2>.

  3. Pahami Tujuan Heading
    Heading tidak hanya untuk ukuran teks, tapi juga untuk memberi struktur yang jelas pada website.

Tantangan: Buat Heading Sendiri

Coba buat file HTML seperti ini:

<!DOCTYPE html>
<html>
<head>
    <title>Latihan Heading</title>
</head>
<body>
    <h1>Judul Utama</h1>
    <h2>Subjudul 1</h2>
    <h3>Bagian 1.1</h3>
    <h2>Subjudul 2</h2>
    <h3>Bagian 2.1</h3>
    <h4>Detail Tambahan</h4>
</body>
</html>

Simpan file dengan nama index.html, lalu buka di browser. Perhatikan hierarki dan ukuran teks.


Kesimpulan
Heading adalah elemen penting dalam HTML untuk membuat struktur website. Dengan memahami cara kerjanya, kita bisa membuat website yang rapi dan terstruktur.

Di pelajaran berikutnya, kita akan mempelajari elemen penting lainnya, yaitu paragraf. Sampai jumpa! 

Comments

Postingan Populer

Image

Superingan is a Blogger template designed with simplicity and functionality in mind, offering a clean and user-friendly platform for professional websites. This theme is perfect for various website types, including personal blogs, online magazines, news websites, and portfolios. Features: Responsive Design: Your website will look its best across all devices, from desktops and laptops to tablets and smartphones. Customizable Colors: Easily change the template's colors to match your branding or preferences. Custom Headers: Upload your own header image to add a personal touch to your website. Custom Menus: Create and manage your website's navigation menus with ease. Widget Areas: Add widgets to display additional content and features on your website's sidebar. Clean HTML & CSS Code: The template is built with clean and well-structured code, making it easy to learn and customize further. Superingan is an ideal choice for those seeking a professional website with a sim...

Image

If you’ve ever struggled to align elements neatly in CSS—or tried to make a layout look good on both desktop and mobile— Flexbox CSS is your new best friend. Short for "Flexible Box Layout," Flexbox is a layout module in CSS3 that provides an efficient way to distribute space and align items in a container, even when their sizes are dynamic. In this flexbox tutorial for beginners , we’ll guide you step-by-step through what Flexbox is, why it’s essential for responsive design, and how to use it to build clean, adaptable layouts. By the end of this guide, you’ll be able to use Flexbox confidently to build elements like navigation bars, feature sections, and even a CSS flexbox pricing table example . Whether you're a self-taught developer, a student, or someone shifting into a front-end career, Flexbox will become one of your most powerful tools in building responsive, user-friendly websites. Before diving into the code, if you're not yet familiar with CSS fundamenta...

Hello friends, how are you doing? If you own a blog or website and want to earn more revenue through Google AdSense, you’ve come to the right place. In this comprehensive article, we’re going to explore a variety of methods to increase your Cost Per Click (CPC) and Click-Through Rate (CTR), two crucial metrics that greatly influence how much you earn from ads on your blog. We will dig into how to make your blog more appealing to advertisers so that the monetary value of each ad click (CPC) goes up, and the percentage of people who click on your ads (CTR) also rises. We’ll discuss why these two factors matter, how to optimize your content, strategies for choosing the right topics, and how to place ads strategically. We’ll also highlight the importance of SEO so that your blog becomes easier for people to find through search engines. With increased visibility in search results, you can attract more visitors—and with more visitors, your opportunities for higher ad clicks multiply, which ...