搜尋

HTML5標籤

Sep 04, 2024 pm 04:36 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

我們都知道HTML的標準縮寫,即超文本標記語言。所以,HTML5是HTML的最新版本。產品開發出來後;顯然,HTML 將會有許多版本,並伴隨著許多新的發展。因此,HTML5 具有新的屬性和行為。 HTML5 標籤不再是一種程式語言,而是一種標記語言。現在,什麼是標記語言?使用文件中的標籤定義元素屬性是一種標記語言。現在,讓我們詳細了解如何定義標籤和建立網頁。

HTML5 標籤

標籤是顯示內容的規格。一般來說,會有開始和結束標籤。此外,很少有標籤不需要結束標籤,例如 ,這意味著換行,顯示下一行中該標籤旁邊的資料。在這裡,讓我們來看看 HTML5 中的一些新元素。

在HTML5中,我們一般可以將標籤分為兩類。

  • 語意元素:這些元素的例子很少; 、、等等
  • 非語意元素: 這裡的例子是;
    等等

    下面討論的標籤是 HTML5 版本中新引入的標籤。它們是不同類型的標籤,都可以分類。

    1.結構標籤

    以下是結構標籤的型別及範例:

    a。文章: 這是一個最常用的標籤,類似 head 標籤。主要用於表單、部落格、新聞報導等範例。

    代碼:

    <article> <h3 id="The-first-one">The first one </h3></article>
    
    <h2>Welcome Back
    
    </h2>

    輸出:

    HTML5標籤

    b。旁白: 類似我們普通標籤的東西,它將內容與周圍的內容相關聯,就像文章中的側邊欄。而且這個標籤只有在使用8以上的IE版本時才有意義。

    c.詳細資料:標籤用於提供使用者一些附加資料。這可以是一個可以隱藏或顯示細節的互動平台。我們可以在summary標籤下看到這個tab的用法。

    d。標題:此標籤與標題部分相關,包含標題資訊。它必須有開始標籤和結束標籤。

    代碼:

    <header>
    <h1 id="Happy-Hours">Happy Hours</h1>
    <nav>
    <p><a href="#">Morning</a> | <a href="#">Afternoon</a> | <a href="#">Evening</a></p>
    </nav>
    </header>
    

    輸出:

    HTML5標籤

    e。 hgroup: 此標籤用於描述一組標頭。讓我們看一下例子。

    代碼:

    
    <hgroup>
    <h1 id="Let-s-check-size-of-this-h">Let’s check size of this h1 </h1>
    <h2 id="Let-s-check-size-of-this-h"> Let’s check size of this h2 </h2>
    <h3 id="Let-s-check-size-of-this-h"> Let’s check size of this h3</h3>
    <h4 id="Let-s-check-size-of-this-h"> Let’s check size of this h4</h4>
    <h5 id="Let-s-check-size-of-this-h"> Let’s check size of this h5</h5>
    </hgroup>
    
    

    輸出:

    HTML5標籤

    f。頁腳: 這個標籤就是那個,它被放置在頁面的末尾。它涉及版權、歷史相關資訊或數據等內容。讓我們來看下面的一個小例子。

    代碼:

    
    <footer>
    <nav>
    <p><a href="#">Copy Rights</a> | <a href="#">Come back soon</a></p>
    </nav>
    <p>Please subsribe for more learning content</p>
    </footer>
    
    

    輸出:

    HTML5標籤

    g。 nav: 此標籤用於提供所有連結的一部分進行導覽。

    代碼:

    
    <nav>
    <ul>
    <li><a href="https://www.educba.com/">EDUCBA Home</a></li>
    <li><a href="https://www.educba.com/about-us/">About EDUCBA</a></li>
    <li><a href="https://www.educba.com/courses/">Courses in EDUCBA</a></li>
    </ul>
    </nav>
    
    

    輸出:

    HTML5標籤

    在練習時編寫程式碼後,請點擊連結進行檢查。

    h。部分: 如名稱所示,該標籤定義了程式碼的正文、頁首、頁尾等部分。這裡,開始標籤和結束標籤都是必要的。讓我們來看下面的一個小例子:

    代碼:

    <section>
    <h1 id="Welcome"> Welcome </h1>
    <h4 id="See-you-soon"> See you soon </h4>
    <p>Thank You.</p>
    </section>
    

    輸出:

    HTML5標籤

    我。摘要:此標籤與詳細資訊標籤並行使用。在詳細資訊標籤下,我們有一個摘要標籤來總結概念。以下範例:

    代碼:

    
    <details>
    <summary>How is this Summary tag defined?</summary>
    <p>By clicking the arrow beside the Summary question I got displayed</p>
    </details>
    <p> The data after the display tag is displayed like this.</p>
    
    

    輸出:

    HTML5標籤

    現在展開摘要標籤數據,我們得到以下內容。

    HTML5標籤

    2.表單標籤

    以下是不同類型的表單標籤,並舉例說明:

    a。 Datalist: 此標籤的使用方式類似於下拉列表,其中有預先定義的值供使用者選擇。讓我們來看看下面的小例子:

    代碼:

    
    <p>Enter your favorite browser name:</p>
    <input type="text" list="browsers">
    <datalist id="browsers">
    <option value="Firefox">
    </option>
    <option value="Chrome">
    </option>
    <option value="Internet Explorer">
    </option>
    <option value="Opera">
    </option>
    <option value="Safari">
    </option></datalist>
    
    

    輸出:

    HTML5標籤

    滑鼠懸停時會彈出下拉式選單。

    HTML5標籤

    b. Keygen: This is for the encryption. It is for generating an encrypted key for passing the data in an encrypted format. Only the start tag is enough/required for this element, and the end tag is not mandatory.

    c. Meter: This tag would give us the measurement of the data which is present in a given range.

    Code:

    
    <meter value="25" min="0" max="100">25 out of 100</meter><p> This is 25 out of 100 </p><br>
    <meter value="0.7">70%</meter><p> This is the range for 70%</p>
    
    

    Output:

    HTML5標籤

    3. Formatting Tags

    Below are the types of formatting tag with examples:

    a. BDI: This is Bi-directional isolation. As the name already suggests, this tag can be used to isolate a part of the text and give it different styles from that of other text.

    b. Mark: This tag can help us highlight a specific text.

    Code:

    
    <p>This is how you can <mark>mark or highlight</mark> a text.</p>
    
    

    Output:

    HTML5標籤

    c. Output: As the name already shows us, it gives the result of any calculation.

    Code:

    
    
    =

    Output:

    HTML5標籤

    Make sure that you notice the form attribute of oninput. Once you input the attribute ‘x’ value, then the output gets displayed.

    d. Progress: This tag gives us the progress of a particular task.

    Code:

    
    <progress value="80" max="100"></progress><p> This progress bar is 80% completed</p>
    
    

    Output:

    HTML5標籤

    e. Rp: This is used when the ruby tags are not supported.

    f. Rt: It is used with the tag ruby. Mostly this is used in pronunciation in both Japanese and Chinese languages.

    g. Ruby: This tag is used with the rt and rp tags where the annotations with respect to the two languages, Chinese and Japanese, are pronounced.

    h. Wbr: This tag is for the word break. It is mainly used to check how a word breaks when the window size is resized.

    4. Embedded Content Tags

    Here are the types of embedded content tag explained below with examples:

    a. Audio: As the name already suggests, this tag would help us to incorporate audio files in the HTML document.

    b. Canvas: Defines a place on the web page where graphics or shapes, or graphs are present or can be defined. Here is an example.

    Code:

    
    <canvas id="run"></canvas>
    <script type="text/javascript">
    window.onload = function(){
    var can = document.getElementById("run");
    var context = can.getContext("2d");
    context.moveTo(30, 60);
    context.lineTo(150, 30);
    context.stroke();
    };
    </script>
    
    

    Output:

    HTML5標籤

    c. Dialog: This tag gives us a default box, especially if we wanted to have data in a box.

    Code:

    
    <p> Trying dialog here <dialog open>How does dialog box come up?</dialog> </p>
    
    

    Output:

    HTML5標籤

    d. Embed: This tag can be used for getting in any external file to the HTML file. We can have only the start tag, and the end tag is not mandatory here. There are different attributes that can be used with this tag, namely, width, height, src, and type.

    e. Figure and Figcaption: This, as already in its name, can incorporate the images and can give a caption to that image.

    f. Source: This tag can implement multiple audio and video files by providing the location of the files using this source tag.

    g. Time: This tag, as the name already notifies, is a tag for displaying the time. And note that this tag is not functional in the cases of internet explorer version 8 and below.

    h. Video: With the name of the tag, we can obviously get to know where this tag is used. For specifying the video files, we have this tag. Inside this Audio/Video tags, we define the source tags in specifying the files and their locations.

    Input Elements of HTML5 Tags

    Here are some input elements which we are using in HTML5 tags:

    1. Email: This is one of the input elements in HTML5. This element takes in only email addresses as the input.

    2. Number: This input element only accepts the number.

    3. Range: As the name already explains, this tag contains a range of numbers.

    4. URL: This input tag accepts the input field for the URL address. In this input type, we can only enter the URL.

    5. Placeholder: This is one of the attributes for the input type as text or text area or any number. This place holder value shows the value to be given as the input.

    Code:

    
    Enter Date of birth : <input type="text" name="dob" placeholder="dd/mm/yyyy">
    
    

    Output:

    HTML5標籤

    6. Autofocus: This attribute automatically focuses on a particular field where this element has been declared inside the input tag. This attribute is supported only by the latest versions of Chrome, Safari, and Mozilla only. The syntax is like this:

    <input type="“textarea”" name="”focus”" autofocus>
    Tag 
    : This tag represents a description of a definition. Tag : This tag deletes a specified text. Tag : This tag helps to display data in a scrolling manner. This texxt is in a scrolling manner

    Output:

    HTML5標籤

    7. : This is one of the basic tags that would help the browser understand the HTML version in which the program is being written. The declaration of this tag is to be written before the HTML tag.

    8. : This Meta tag describes the description of the HTML document. It contains the author’s name, date, and modifications, etc.

    In this HTML5, we even have an opportunity to get the GeoLocation of a device. There are different methods that can be helpful in making this location tagging easy. There are also different fonts and colors available in HTML5. Below are the few tags that are removed from the HTML usage from this HTML5 version.

    Acronym, Applet, big, dir, font, frameset, center, tt (TeleType text), basefont, center, strike, frame, u (underlined text), isindex, noframes, etc. Few attributes that are removed are below:

    Align, bgcolor, cellpadding, cellspacing, border, link, shape, charset, archive, codebase, scope, alink, vlink, link, background, border, clear, scrolling, size, width, etc.

    9. This tag is used to display the content where the use of JavaScript is disabled. Any content written inside this tag can be used in place of the content wherever javascript is used. As an exercise, can you try executing the different tags for which examples are not provided?

    Conclusion

    So, yes, there are the basic tags and references for HTML5. The initial version of HTML5 was released on 28th October 2014. We have seen different new tags that were introduced and had gone through a few attributes in HTML5. In the end, we had even covered that not only the introduction of new elements was done, but some elements and attributes that were present were restricted from use through this new release of HTML5.

    There were many attributes that were given with examples and some with only the data and the purpose of the attribute or elements. Try practicing all those different elements and attributes and keep learning.

以上是HTML5標籤的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
如何驗證您的HTML代碼?如何驗證您的HTML代碼?Apr 24, 2025 am 12:04 AM

HTML代碼可以通過在線驗證器、集成工具和自動化流程來確保其清潔度。 1)使用W3CMarkupValidationService在線驗證HTML代碼。 2)在VisualStudioCode中安裝並配置HTMLHint擴展進行實時驗證。 3)利用HTMLTidy在構建流程中自動驗證和清理HTML文件。

HTML與CSS和JavaScript:比較Web技術HTML與CSS和JavaScript:比較Web技術Apr 23, 2025 am 12:05 AM

HTML、CSS和JavaScript是構建現代網頁的核心技術:1.HTML定義網頁結構,2.CSS負責網頁外觀,3.JavaScript提供網頁動態和交互性,它們共同作用,打造出用戶體驗良好的網站。

HTML作為標記語言:其功能和目的HTML作為標記語言:其功能和目的Apr 22, 2025 am 12:02 AM

HTML的功能是定義網頁的結構和內容,其目的在於提供一種標準化的方式來展示信息。 1)HTML通過標籤和屬性組織網頁的各個部分,如標題和段落。 2)它支持內容與表現分離,提升維護效率。 3)HTML具有可擴展性,允許自定義標籤增強SEO。

HTML,CSS和JavaScript的未來:網絡開發趨勢HTML,CSS和JavaScript的未來:網絡開發趨勢Apr 19, 2025 am 12:02 AM

HTML的未來趨勢是語義化和Web組件,CSS的未來趨勢是CSS-in-JS和CSSHoudini,JavaScript的未來趨勢是WebAssembly和Serverless。 1.HTML的語義化提高可訪問性和SEO效果,Web組件提升開發效率但需注意瀏覽器兼容性。 2.CSS-in-JS增強樣式管理靈活性但可能增大文件體積,CSSHoudini允許直接操作CSS渲染。 3.WebAssembly優化瀏覽器應用性能但學習曲線陡,Serverless簡化開發但需優化冷啟動問題。

HTML:結構,CSS:樣式,JavaScript:行為HTML:結構,CSS:樣式,JavaScript:行為Apr 18, 2025 am 12:09 AM

HTML、CSS和JavaScript在Web開發中的作用分別是:1.HTML定義網頁結構,2.CSS控製網頁樣式,3.JavaScript添加動態行為。它們共同構建了現代網站的框架、美觀和交互性。

HTML的未來:網絡設計的發展和趨勢HTML的未來:網絡設計的發展和趨勢Apr 17, 2025 am 12:12 AM

HTML的未來充滿了無限可能。 1)新功能和標準將包括更多的語義化標籤和WebComponents的普及。 2)網頁設計趨勢將繼續向響應式和無障礙設計發展。 3)性能優化將通過響應式圖片加載和延遲加載技術提升用戶體驗。

HTML與CSS vs. JavaScript:比較概述HTML與CSS vs. JavaScript:比較概述Apr 16, 2025 am 12:04 AM

HTML、CSS和JavaScript在網頁開發中的角色分別是:HTML負責內容結構,CSS負責樣式,JavaScript負責動態行為。 1.HTML通過標籤定義網頁結構和內容,確保語義化。 2.CSS通過選擇器和屬性控製網頁樣式,使其美觀易讀。 3.JavaScript通過腳本控製網頁行為,實現動態和交互功能。

HTML:是編程語言還是其他?HTML:是編程語言還是其他?Apr 15, 2025 am 12:13 AM

HTMLISNOTAPROGRAMMENGUAGE; ITISAMARKUMARKUPLAGUAGE.1)htmlStructures andFormatSwebContentusingtags.2)itworkswithcsssforstylingandjavascript for Interactivity,增強WebevebDevelopment。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

Atom編輯器mac版下載

Atom編輯器mac版下載

最受歡迎的的開源編輯器

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。