Comments and neat nesting · Nhận xét và lồng ghép gọn gàng
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Trang này cần trình duyệt gần đây (hỗ trợ SharedArrayBuffer). Vui lòng cập nhật Chrome, Edge, Firefox hoặc Safari lên phiên bản mới nhất.
Comments
- A comment is a note for you, not for the reader.
- The browser ignores it — it never shows on the page.
- Write it like this:
<!-- this is a comment -->.
<!-- The header goes here -->
<h1>Welcome</h1>
<!-- TODO: add a photo below -->
Tags go inside tags
- HTML tags nest: one pair can sit inside another.
- A
<div>is a plain box you can put other things in. - Indent the inside tags a little, so the nesting is easy to read.
<div>
<h2>My card</h2>
<p>Some text inside the box.</p>
</div>
Common mistakes
- Tags must nest, not overlap:
<b><i>x</i></b>, never<b><i>x</b></i>. - A comment is
<!-- ... -->and is ignored by the browser.
Now you try
- Comments help you stay organised; nesting builds structure.
- Leave a comment, then nest a paragraph inside a
<div>.
Explore · Khám phá
Neat nesting = the tree · Lồng ghép gọn gàng = cây cấu trúc
Indentation in your HTML mirrors the parent/child tree. · Khoảng cách thụt vào trong HTML của bạn phản ánh cây cha/con.
Leave a note for yourself. Add a comment, like <!-- TODO: add a photo -->. · Để lại ghi chú cho bản thân. Thêm một bình luận, ví dụ như <!-- TODO: add a photo -->.
Put the paragraph inside a box. Wrap it in a <div> … </div>. · Đặt đoạn văn bên trong một hộp. Bao quanh nó bằng <div> … </div>.