搜尋
首頁web前端js教程自行開發建立 Web UI:部分了解 HTML

Web 開發是當今最受歡迎的技能之一。它涉及創建可透過瀏覽器訪問的用戶友好且引人入勝的網站。成為 Web 開發人員的第一步是了解 HTML。

Develop yourself to build Web UIs: Part  Understanding HTML

HTML超文本標記語言)是任何網頁的支柱。它是用來建立網頁的標準語言,決定內容在瀏覽器中的顯示方式。雖然頁面的外觀由CSS (層疊樣式表) 決定,其功能由JS (Javascript) 決定,HTML 負責基本骨架或結構。

在深入學習這部分課程之前,了解您的旅程中將使用的著名和反覆出現的術語非常重要。這些將幫助您隨著我們的進展理解概念(也讓作者更容易解釋事情;-))。


了解行話

  1. 程式語言:以電腦可以執行的特定語法(程式語言的方式)編寫的一組指令。請記住,電腦只能理解二進位代碼(1 或0),現在,為了使電腦理解邏輯並找到權衡,我們(人類)創建了一種程式語言,以便可以輕鬆地我們編碼,也讓電腦理解它。
  2. 編譯器:將用程式語言編寫的程式碼翻譯成電腦可以理解和執行的機器語言的工具。
  3. 語法:定義程式語言結構的規則。將其視為句子中單字的排列方式以使其有意義。
  4. 註釋:程式碼中的註釋,解釋程式碼某些部分的作用。註釋可以幫助其他開發人員(或未來的你)理解程式碼背後的邏輯。
  5. DOM(文件物件模型):DOM 是 HTML 文件的樹狀表示。 HTML 中的每個標籤都成為該樹中的一個節點。例如,如果您的 HTML 有一個 帶有

    的標籤(paragraph) 在其中,瀏覽器建立一個主體節點,並以段落節點作為其子節點。

  6. 孩子:隨著你的進步,你就會明白這一點。元素嵌套在另一個元素內。例如,在 HTML 中,div 標籤 (
    ) 內的段落標籤 (

    ) 將被視為 div 的子層級。

  7. 區塊級元素:隨著您的進步,您將了解這個術語。這個術語通常描述元素的特徵,即它將佔據全部可用寬度。

  8. 使用 HTML 啟動

    HTML 代表 超文本標記語言

    • 超文本:指 HTML 將不同文件連結在一起的能力。

    • 標記語言:使用標籤來註釋文本,定義文本在瀏覽器中的顯示方式。

    這是 HTML 文件的基本結構:

    
      
        <title>HTML Tutorial</title>
      
      
        <p>Hello, world!</p>
      
    
    
    • 標籤:在 HTML 中,標籤用來定義元素。標籤括在尖括號中,例如 或

    • 元素:由開始標籤和結束標籤組成,其中可能包含內容。例如,

      你好,世界!

      是一個段落元素。

    HTML 文件結構

    每個 HTML 文件都遵循一個基本結構:

    1. : Declares the document type and version of HTML.
    2. : The root element that encloses all other HTML elements.
    3. : Contains meta-information about the document, such as the title and links to stylesheets.
    4. : Sets the title of the webpage, displayed in the browser's title bar or tab.
    5. : Provides metadata about the HTML document, such as character set, author, and viewport settings. It's a self-closing tag.
    6. : Embeds CSS code to style the HTML elements.
    7. <script></script>: Embeds JavaScript code for adding interactivity to the webpage.
    8. : Encloses the content that will be visible to users on the webpage.

    Commonly Used HTML Elements

    Here are some basic HTML elements you’ll use frequently:

    • : Defines a paragraph.
    • : A block-level element used to group other elements together.
    • : An inline element used to group text for styling purposes.
    • : Represents the introductory content or navigational links of a section.
    • to
      : Headings, with

      being the highest level and

      the lowest.

    • : Inserts a line break (self-closing tag — meaning there is no need to close the tag).
    • : Used to create an HTML form for user input.
    • : Creates an input field, typically used within a form.
    • : Creates a dropdown list.
    • : Associates a text label with a form element.
    • : Defines a table.
    • : Defines a row in a table.
    • : Defines a cell in a table row.
    • : Defines a header cell in a table row.
      • : Defines an unordered (bulleted) list.
        1. : Defines an ordered (numbered) list.
        2. : Defines a list item.

        Creating Your First HTML File

        To create an HTML file, you can use any text editor, such as Notepad or VS Code. Here’s a simple example:

        1. Open your text editor and type the following code:
        
        
          <title>HTML Tutorial</title>
        
        
          <h1 id="Example-Number">Example Number 1</h1>
          <p>Hello, world!</p>
        
        
        
        1. Save the file with a .html extension (e.g., index.html)
        2. Open the file in your web browser to see your first HTML webpage in action!
        3. To inspect your code, press Ctrl + Shift + C in Google Chrome to open the Developer Tools and explore the DOM structure.
        4. Go to the network tab in the Developer Tools and refresh your browser tab.

        You can find that there is a request in the name that you have saved as in this picture.
        Develop yourself to build Web UIs: Part  Understanding HTML

        In the response tab, you will find the code that you have written as in the following picture
        Develop yourself to build Web UIs: Part  Understanding HTML

        Now, what happened is that, once you opened the file you have saved as html, the computer began running the file in browser. The browser wanted something to show, so it made a request call to the file from which it was launched. The file gave the browser your code and that was found in the response section. Since it was a html file, the browser begins reading the HTML code from the top to the bottom. This process is known as parsing. During parsing, the browser encounters different HTML tags (like ,

        , , etc.) and starts to build a structure called DOM based on these tags. As the browser builds the DOM, it simultaneously renders the content on your screen.

        Creating a Table

        Let’s take a step further by creating a simple table in HTML:

        1. Open the same HTML file and add the following code inside the tag:
        <p>Table Example</p>
        
        Name Power Is Kurama Present
        Naruto Rasengan Yes
        Sasuke Sharingan No
        1. Save the file and refresh your browser to see the table displayed.

        Notice the heading is being rendered by paragraph tag. Alternatively, you can also use

        tag, which will center the heading of the table. Experiment with the caption tag and refresh to see the changes.

        Note that

        tag should only be used immediately after the opening tag.

        You’ve now successfully created a basic table in HTML. Feel free to experiment with additional rows and columns to get more comfortable with HTML syntax.


        Conclusion

        Congratulations on completing your first steps into web development with HTML! The key to mastering HTML is practice. Experiment with different elements, create your own webpages, and don’t be afraid to make mistakes — every error is a learning opportunity.

        Remember, this is just the beginning. As you continue to build on this foundation, you’ll soon be able to create more complex and dynamic websites. Let’s make the web a better place, one line of code at a time.

        本文由 Anantha Krishnan 撰寫,他是一位在 IT 和機械工程領域擁有豐富經驗的專業人士。 Anantha Krishnan 擁有全端開發背景以及對機械和電氣系統的熱情,現在專注於創建教育內容,以幫助其專業領域的初學者。

      以上是自行開發建立 Web UI:部分了解 HTML的詳細內容。更多資訊請關注PHP中文網其他相關文章!

      陳述
      本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
      在JavaScript中替換字符串字符在JavaScript中替換字符串字符Mar 11, 2025 am 12:07 AM

      JavaScript字符串替換方法詳解及常見問題解答 本文將探討兩種在JavaScript中替換字符串字符的方法:在JavaScript代碼內部替換和在網頁HTML內部替換。 在JavaScript代碼內部替換字符串 最直接的方法是使用replace()方法: str = str.replace("find","replace"); 該方法僅替換第一個匹配項。要替換所有匹配項,需使用正則表達式並添加全局標誌g: str = str.replace(/fi

      自定義Google搜索API設置教程自定義Google搜索API設置教程Mar 04, 2025 am 01:06 AM

      本教程向您展示瞭如何將自定義的Google搜索API集成到您的博客或網站中,提供了比標準WordPress主題搜索功能更精緻的搜索體驗。 令人驚訝的是簡單!您將能夠將搜索限制為Y

      示例顏色json文件示例顏色json文件Mar 03, 2025 am 12:35 AM

      本文系列在2017年中期進行了最新信息和新示例。 在此JSON示例中,我們將研究如何使用JSON格式將簡單值存儲在文件中。 使用鍵值對符號,我們可以存儲任何類型的

      10個jQuery語法熒光筆10個jQuery語法熒光筆Mar 02, 2025 am 12:32 AM

      增強您的代碼演示文稿:10個語法熒光筆針對開發人員在您的網站或博客上共享代碼段的開發人員是開發人員的常見實踐。 選擇合適的語法熒光筆可以顯著提高可讀性和視覺吸引力。 t

      構建您自己的Ajax Web應用程序構建您自己的Ajax Web應用程序Mar 09, 2025 am 12:11 AM

      因此,在這裡,您準備好了解所有稱為Ajax的東西。但是,到底是什麼? AJAX一詞是指用於創建動態,交互式Web內容的一系列寬鬆的技術。 Ajax一詞,最初由Jesse J創造

      8令人驚嘆的jQuery頁面佈局插件8令人驚嘆的jQuery頁面佈局插件Mar 06, 2025 am 12:48 AM

      利用輕鬆的網頁佈局:8 ESTISSEL插件jQuery大大簡化了網頁佈局。 本文重點介紹了簡化該過程的八個功能強大的JQuery插件,對於手動網站創建特別有用

      10 JavaScript和JQuery MVC教程10 JavaScript和JQuery MVC教程Mar 02, 2025 am 01:16 AM

      本文介紹了關於JavaScript和JQuery模型視圖控制器(MVC)框架的10多個教程的精選選擇,非常適合在新的一年中提高您的網絡開發技能。 這些教程涵蓋了來自Foundatio的一系列主題

      什麼是這個&#x27;在JavaScript?什麼是這個&#x27;在JavaScript?Mar 04, 2025 am 01:15 AM

      核心要點 JavaScript 中的 this 通常指代“擁有”該方法的對象,但具體取決於函數的調用方式。 沒有當前對象時,this 指代全局對象。在 Web 瀏覽器中,它由 window 表示。 調用函數時,this 保持全局對象;但調用對象構造函數或其任何方法時,this 指代對象的實例。 可以使用 call()、apply() 和 bind() 等方法更改 this 的上下文。這些方法使用給定的 this 值和參數調用函數。 JavaScript 是一門優秀的編程語言。幾年前,這句話可

      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脫衣器

      AI Hentai Generator

      AI Hentai Generator

      免費產生 AI 無盡。

      熱門文章

      R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
      2 週前By尊渡假赌尊渡假赌尊渡假赌
      倉庫:如何復興隊友
      4 週前By尊渡假赌尊渡假赌尊渡假赌
      Hello Kitty Island冒險:如何獲得巨型種子
      4 週前By尊渡假赌尊渡假赌尊渡假赌

      熱工具

      Dreamweaver CS6

      Dreamweaver CS6

      視覺化網頁開發工具

      SecLists

      SecLists

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

      Safe Exam Browser

      Safe Exam Browser

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

      EditPlus 中文破解版

      EditPlus 中文破解版

      體積小,語法高亮,不支援程式碼提示功能

      mPDF

      mPDF

      mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),