Ví dụ về thẻ rỗng trong HTML

Thẻ trống trong HTML là gì

Bài viết này nói về thẻ trống trong HTML là gì và liệt kê một số ví dụ về thẻ trống

Thẻ trống là gì?

  • Các thẻ không yêu cầu thẻ đóng được gọi là thẻ rỗng
  • Nó còn được gọi là thẻ chưa ghép nối
  • Thẻ trống chỉ có thẻ BẬT, thẻ vùng chứa có cả thẻ BẬT và TẮT nhưng thẻ trống chỉ có thẻ BẬT
  • Also, an empty tag contains attributes, but some tags have no attributes. Eg:
    ,

Ví dụ về thẻ rỗng

  • -dòng đầu tiên của tài liệu HTML

  • – thẻ ngắt dòng
  • – Thẻ quy tắc ngang
  •  

    Trước tiên, bạn nên kiểm tra xem có thẻ kết thúc không, nếu không, đó là thẻ trống

    Mỗi trang web phải bắt đầu bằng một khai báo DOCTYPE. Nó phải là mục đầu tiên trên dòng đầu tiên của mã HTML hoặc XHTML của bạn. Điều này cho trình duyệt biết trang web được mã hóa bằng phiên bản HTML nào, giúp họ biết cách xử lý mã. Trước HTML5, khai báo DOCTYPE dài và phức tạp. Ví dụ: đây là khai báo DOCTYPE cho XHTML 1. 1

    Trong HTML5, việc khai báo DOCTYPE đơn giản hơn rất nhiều

    Hiểu các bảng sau

    Các thẻ HTML phổ biến được trình bày bên dưới, được sắp xếp thành bốn bảng dựa trên mục đích của chúng. Bảng đầu tiên bao gồm các thẻ kiểm soát cấu trúc tổng thể của trang web. Bảng thứ hai và thứ ba bao gồm các thẻ đánh dấu phần lớn nội dung trang web. Các thẻ chứa [những thẻ chứa nội dung] được trình bày trong bảng thứ hai và các thẻ không chứa [những thẻ đứng một mình] được trình bày trong bảng thứ ba. Bảng cuối cùng chứa các thẻ được sử dụng để đánh dấu các bảng HTML, được trình bày trong Mô-đun 5 của đơn vị này

    Cấu trúc tài liệu

    Opening TagClosing TagDescriptionOpens and closes an HTML documentThe first of two main sections of an HTML document. The section is used to provide information about the document for use primarily by search engines and browsers. The title of document. This element is nested inside the section. In HTML5, this is the only required tag other than the DOCTYPE declaration.The second of two main sections of an HTML document. The section contains all the content of the web page.

    Thẻ nội dung [vùng chứa]

    Thẻ mở Thẻ đóng Mô tảtotoTiêu đề. H1 là tiêu đề chính, H2 là tiêu đề phụ, v.v. Đoạn Một vùng chứa cho một khối nội dung Một vùng chứa cho nội dung trong dòng, chẳng hạn như nội dung bên trong một đoạn văn. Nhấn mạnh văn bản chứa trong đó [thường là chữ in nghiêng]. Làm cho văn bản được in đậm. Liên kết Danh sách có thứ tự [được đánh số] Danh sách không có thứ tự [gạch đầu dòng] Mục danh sách, phải được lồng bên trong một thành phần danh sách, chẳng hạn như một
      hoặc là
    Nhận xét. Bất cứ điều gì giữa các thẻ này không được hiển thị trên màn hình. Điều này hữu ích để ghi chú cho chính bạn hoặc cho những người khác có thể xem mã nguồn của trang web

    Thẻ ngữ nghĩa HTML5

    HTML5 đã giới thiệu một số thẻ mới được gọi là thẻ ngữ nghĩa. Các thẻ này được thiết kế để truyền đạt chức năng của các khối nội dung phổ biến trên nhiều trang web. Trước HTML5, các nhà phát triển chỉ sử dụng

    Trong bài viết này, chúng ta sẽ tìm hiểu về các thẻ trống trong HTML & chúng ta cũng sẽ tập trung vào mục đích sử dụng thẻ trống. Phần tử trống là thành phần không có bất kỳ phần tử nhúng hoặc phần tử văn bản nào. Các phần tử trống không có các nút kế tiếp. Nói cách khác, các thẻ không chứa bất kỳ thẻ đóng nào là các thẻ trống. Các thẻ trống chỉ chứa thẻ mở nhưng chúng thực hiện một số hành động trong trang web

    cú pháp

    An element that does not have an enclosing tag is called an empty element. Adding the closing tags to the empty elements will be invalid syntax. The empty elements don’t have any child nodes. In short, Empty elements are self-closing or void and not container tags. The empty elements are used to embed images, lists, breaks, horizontal lines, hyperlinks, for input, meta-data, area, etc. For instance,

    tag had a closing tag hence it was not an empty element.

    Dưới đây là danh sách các phần tử rỗng sử dụng trong HTML

    yếu tố

    Sự miêu tả

    It is used to map a portion of an image to make it clickable by the end-user. It is used to direct the user to different links after the user clicks on the mapped portions of the image. It is used as a child tag of the tag. 

    For all relative URLs in a document, the base URL is specified to use with the element. Only one element can be used in a document.


    The
    element is used for a line break in a text [can also be called carriage-return]. It is useful in the case of writing an address, story, blogs, etc where the long sentence needs to break for clear visibility.

    The tag in HTML is used to set the column properties for each column within a tag. This tag is used to set the style property to each column. This tag does not contain closing tags.

    The tag in HTML is used for embedding external applications which are generally multimedia content like audio or video into an HTML document. It is used as a container for embedding plug-ins such as flash animations.

    A thematic break between paragraph-level components is represented by the element. For instance, a change of shift in the topic within a section.

    The element is used to embed an image into the document.

    This empty element is used to create interactive controls for web-based applications and forms, for accepting the information from the user such as an address, name, phone number, etc, depending on a variety of types of input data and control widgets are available. All the input types and attributes are used inside the element.

    The HTML element is used to establish a connection between the current content and an external resource. For instance, we can use it to link the external stylesheet or javascript file, etc.

    The HTML element represents metadata i.e., information of a information.

    The tag in HTML is used to define a parameter for plug-ins which is associated with element. It does not contain the end tag.

    The element is an empty element that provides various media resources for the , , or elements.  It provides the same media material in several file formats to ensure compatibility with a wide variety of browsers, as image and media file formats are supported by the browsers differently.

    The tag specifies text tracks for media components audio and video. This part is employed to specify subtitles, caption files, or different files containing text, that ought to be visible once the media is taking part in. The element is an empty HTML element that is used as a child of the audio and video media components. It allows you to define timed text tracks [or time-based data], for example, to handle subtitles automatically. WebVTT format [.vtt files] — Web Video Text Tracks — is used for the tracks.

    The tag in HTML stands for word break opportunity and is used to define the position within the text which is treated as a line break by the browser. It is mostly used when the used word is too long and there are chances that the browser may break lines at the wrong place for fitting the text.

    Ví dụ mã dưới đây minh họa việc sử dụng các phần tử trống. Chúng tôi chỉ sử dụng một vài trong số chúng ở đây

    Thí dụ

    HTML




      

    2______24 5=7 8

    2______24

    2____76______77 8

    2____80>7 8

    2____84____77 8

    2______2>11>

    2______2100>1>

    2____2____105>

    07

    11

    07

    11

    11

    11

    07=4____134>

    2____54____105>

    2______2>191>1>

    2____2____196 97=

    99

    07html8____5

Chủ Đề