HTML 是如何運作的?

WBOY
發布: 2024-09-04 16:13:21
原創
668 人瀏覽過

HTML 是一種基於標籤的語言,用於開發網頁; HTML 代表超文本標記語言。超文本是指網頁連結在一起的方式。因此,網頁上可用的連結稱為超文本。它是一種標記語言,標籤告訴瀏覽器如何在其上呈現頁面。 Berners-Lee 在 1991 年底開發了它,但「HTML2.0」是 1995 年發布的第一個標準規範。後來,它的許多 HTML 版本出現了,例如 HTML 4.0;目前,它的最新版本是HTML5.0,在前端網站開發中非常有名。

HTML 頁面的工作原理

讓我們看看 HTML 頁面的工作原理。

<!DOCTYPE html>
<html>
<head>
<title>title tag of html</title>
</head>
<body>
<h1>heading tag of html</h1>
<p>paragraph tag of html<p>
</body>
</html>
登入後複製

此標籤定義文件的類型和 HTML 版本。

上面的標籤包含了完整的 HTML 程式語言文檔,包括由

... 表示的文檔頭。以及由 ... 表示的文件正文標籤。

head 標籤代表文件的標題,可以保留其他 HTML 標籤,如

、<link> 等。等等 <h4></h4> <p>此標籤在 </p> 內部使用標籤來寫入文件標題。 <h4></h4> <p>標籤代表文件的主體,其中保留其他 HTML 標籤,如 </p> <div>、<h1>、</h1> <p> 等。等等</p> <h3>HTML作品的不同標籤及其描述</h3> <p>HTML 運作原理的不同標籤解釋如下:</p> <h4><h1></h1></h4> <p>標題標籤用於建立下面給出的標題範例的變體</p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><!DOCTYPE html> <html> <head> <title>Heading Example</title> </head> <body> <h1>Heading 1</h1> <h2>Heading 2</h2> <h3>Heading 3</h3> <h4>Heading 4</h4> <h5>Heading 5</h5> <h6>Heading 6</h6> </body> </html></pre><div class="contentsignin">登入後複製</div></div> <p><strong>輸出</strong></p> <p>標題 1<br> 標題 2<br> 標題 3<br> 標題 4<br> 標題 5<br> 標題 6</p> <h4></h4> <p> </p> <p>這是一個段落標籤,透過下面給出的範例可以更好地理解。 </p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><!DOCTYPE html> <html> <head> <title>Paragraph Example</title> </head> <body> <p>This is a first paragraph of text.</p> <p>This is a second paragraph of text.</p> <p>This is a third paragraph of text.</p> </body> </html></pre><div class="contentsignin">登入後複製</div></div> <p><strong>輸出</strong></p> <p>這是正文的第一段。 <br> 這是正文的第二段。 <br> 這是正文的第三段。 </p> <h4><br></h4> <p>該標籤用於斷行;當我們想要任何東西從下一行開始時,我們可以使用這個標籤。它是一個單行標記,不需要結束標記。 </p> <h4></h4> <p>將整個內容放在中心位置,這是該標籤在網頁創建中的主要用途。 </p> <h4><hr></h4> <p>用於建立線條,主要用於繪製單線網頁時。 </p> <h4></h4> <p>這是HTML非常重要的標籤;在某些情況下,我們希望顯示的所有內容與 HTML 頁面中編寫的內容相同;在這些情況下,它是一個非常有用的標籤。下面給出了一個範例。 </p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><!DOCTYPE html> <html> <head> <title>Preserve Formatting Example</title> </head> <body> <pre class="brush:php;toolbar:false"> Laravel is the PHP framework. It is an open source framework used in web application development. This framework is based on model view controller design pattern due to this project developed with help of this framework are more structured and manageable.  This framework reuses the existing </pre> </body> </html></pre><div class="contentsignin">登入後複製</div></div> <p><strong>輸出</strong></p> <p>Laravel 是 PHP 框架。它是一個用於網路的開源框架<br> 應用程式開發。該框架基於模型視圖控制器<br> 在這個框架的幫助下開發的這個專案的設計模式是<br> 更加結構化和易於管理。  此框架重複使用了現有的</p> <h4> </h4> <p>要列印單一空格,這在 HTML 中使用。 </p> <h4>標籤屬性</h4> <p>我們可以在標籤層級設定屬性,範例如下</p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><!DOCTYPE html> <html> <head> <title>Align Attribute</title> </head> <body> <p align = "left">Left aligned</p> <p align = "center">Center aligned</p> <p align = "right">Right aligned</p> </body> </html></pre><div class="contentsignin">登入後複製</div></div> <p><strong>輸出</strong></p> <p>左對齊<br> 居中對齊<br> 右對齊</p> <h3>HTML 的核心屬性</h3> <p>有幾個核心屬性已與下面的幾乎所有 HTML 元素一起使用。 </p> <ul> <li>身分證</li> <li>標題</li> <li>班級</li> <li>類型</li> </ul> <h4>1) 身分證字號</h4> <p>該屬性用於唯一標識頁面中的HTML元素;同一元素可能已在HTML 頁面中的多個位置使用,透過id 屬性我們可以識別該元素及其內容,並且可以在javascript 中用於其他目的。下面給出了一個範例。 </p> <p><code><p id="html">這是第一段,解釋什麼是 HTML,如何使用它</p> <code><p id = "html">This is first paragraph which  explains what is HTML  how to use it</p><br> <p id = "css">This it second para which  explains what is Cascading Style Sheet and how to use it</p> </code> <p id="css">這是第二段,解釋什麼是級聯樣式表以及如何使用它</p> </code></p> <p>說明 – 在上面的範例中,同一個元素使用了兩次,僅透過 ID 來區分該元素。 </p> <h4>2) 標題</h4> <p>此屬性語法類似於 id 屬性,此屬性的用途取決於攜帶它的元素;雖然當遊標移到元素上時它通常顯示為工具提示,但這是該屬性的主要用途。下面給出了範例 –</p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><!DOCTYPE html> <html> <head> <title> title Attribute Example</title> </head> <body> <h3 title = "Hello Title Example Test">Sleeping from the long time</h3> </body> </html></pre><div class="contentsignin">登入後複製</div></div> <p><strong>輸出</strong></p> <p>睡了好久</p> <p>If we try to bring our cursor over “Sleeping from a long time”, we will see that whatever title we have used in our code is coming out as a tooltip of the cursor.</p> <h4>3) Class</h4> <p>The class attribute is used to associate an element with a style sheet and specifies the class of element. We will learn more about the use of the class attribute when we will learn Cascading Style Sheet (CSS).Its main use is CSS. Value for this attribute may also be a space-separated list of class names. The example is given below –</p> <p><code>class = "className11 className12 className53"</code></p> <h4>4) Style</h4> <p>It is used to writing the cascading style rule at the element level, which can be better explained by the example given below.</p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><!DOCTYPE html> <html> <head> <title>The style Attribute</title> </head> <body> <p style = "font-family:arial; color:#FF0000;">This is style example text , it is red color...</p> </body> </html></pre><div class="contentsignin">登入後複製</div></div> <p><strong>Output</strong></p> <p>This is a style example text; it is red color…</p> <h3>Conclusion</h3> <p>As we saw many basics tags, the web page can be created with the help of these tags, which can be displayed to the end-user whenever a user requests the particular web page through his web browser, the work of displaying will be done by the web browser. Today lots of new tags exist into the market to make web pages more attractive.</p> </div>

以上是HTML 是如何運作的?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:php
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!