HTML 指令

王林
發布: 2024-09-04 16:13:50
原創
732 人瀏覽過

HTML 的意思是超文本標記語言,是網頁的標準標記語言。 HTML 將具有元素、屬性和其他標籤。網路上的網站大多使用 HTML。 HTML 易於學習且功能強大。超文本是透過點擊超連結在網路上移動的主要方法,超連結會重定向到另一個頁面。標記透過將測試標記為某種類型,使用 HTML 標記顯示其中的文字。 HTML Command 元素是 HTML 頁面的建構塊,可具有提供有關該元素的附加資訊的屬性,並且屬性將成對出現。

基本 HTML 指令

基本指令如下:

1. HTML 文件語法範例

範例 HTML 文件將包含作為網頁建構塊的 HTML 元素,其中一些 HTML 元素是 (根元素)、 等。其中將包含元訊息,

其中包含文件的標題和 其中包括文件的資料。

代碼:

html>

<meta>
<title>Page Title</title>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

登入後複製

輸出:

HTML 指令

2. HTML 標題

HTML 標題是用標籤

定義的 HTML 元素。到

其中

定義最重要的標籤和

定義不太重要的標籤。

範例 HTML 程式碼,標題如下:

<h1> This is heading 1 </h1>
<h2> This is heading 2 </h2>
<h3> This is heading 3 </h3>
<h4> This is heading 4 </h4>
登入後複製

輸出:

HTML 指令

3. HTML元素段落

HTML 段落是我們使用

定義的 HTML 元素。標籤,範例程式碼如下:

<p> This is a paragraph </p>
<p> This is another paragraph </p>
登入後複製

輸出:

HTML 指令

4. HTML 圖片

HTML圖像是用標籤HTML 指令定義的HTML元素,我們需要提及圖像的src等屬性,alt表示替代文本,要顯示的圖像的寬度和高度,示例代碼是

代碼:

<img src="HTML%20%E6%8C%87%E4%BB%A4.jpg" alt="HTML 指令"   style="max-width:90%">
登入後複製

輸出:

HTML 指令

5. Html 列表

HTML 清單是一個 HTML 元素,使用標籤

    定義。或
    其中
    是一個無序列表且
    ;是一個有序列表

    代碼:

    登入後複製
    登入後複製
  • Coffee
  • Tea
  • Milk

輸出:

HTML 指令

6.建立表格

HTML table 是一個 HTML 元素,可以使用標籤

來定義它。以及標籤 的行以及標籤
的儲存格程式碼如下:

代碼:

登入後複製
登入後複製
Firstname Lastname Age
Jill Smith 50

輸出:

HTML 指令

7.提及連結

HTML 連結是 HTML 元素,可以使用標籤 來定義它們。範例程式碼如下:

代碼:

<a href="https://www.HTML%20%E6%8C%87%E4%BB%A4.com">This is a link </a>
登入後複製

輸出:

HTML 指令

8.樣式屬性

HTML屬性樣式可以與

等任一HTML元素組合使用,範例程式碼如下:

代碼:

<p style="color:red"> I am a paragraph </p>
登入後複製

輸出:

HTML 指令

9. lang 屬性

在 HTML 中,使用 lang 屬性,我們可以使用 聲明文件的語言。標籤,語言使用 lang 屬性定義,範例程式碼如下:

代碼:



...
...

登入後複製

輸出:

HTML 指令

10。設定 HTML 元素的格式

在HTML中,我們可以使用格式化元素來格式化HTML文檔,並且我們可以為具有特殊意義的文字定義特殊元素。 HTML 元素如 對於粗體,;斜體

代碼:

<b> This text is bold. </b>
登入後複製

輸出:

HTML 指令

中級 HTML 指令

中間指令如下:

1.突出顯示文字

在 HTML 中,我們可以使用元素 來反白 HTML 文件中的某些文字。以便它突出顯示 中包含的文字元素,範例程式碼如下:


<h2> html <mark> Marked </mark> formtting </h2>

登入後複製

輸出:

HTML 指令

2. Delete text

In HTML, we can delete some text using element so that the text which is enclosed between this element is deleted, and the sample code is as below:


<p> My favorite color is <del> Navy blue </del> Red </p>

登入後複製

Output:

HTML 指令

3. Define superscripted text

In HTML, we can define the text as superscripted using element in the HTML document so that text enclosed in element will be superscripted, and the sample code is as below:


<p> This is <sup> superscripted </sup> text </p>

登入後複製

Output:

HTML 指令

4. Define abbreviation

In HTML, we can define abbreviations by using the HTML element in the HTML document, which will give useful information to browsers, and the sample code is as below:


<p> The <abbr title="World Health Organization">WHO </abbr> was founded in 1948 </p>

登入後複製

Output:

HTML 指令

5. Mention Address

In HTML, we can mention the address in an HTML document using HTML element

, which defines contact information or address related to the article or document and displays in italics and the sample code as below:

<address>
Written by Srinivas <br>
dasu.com <br>
Pincode : 500084, Hyderabad <br>
India
</address>

登入後複製

Output:

HTML 指令

Advanced HTML Commands

The advanced commands are as follows:

1. Display a webpage inside a webpage

In HTML, we can display a webpage inside a webpage using HTML iframe, which is defined using the tag


<iframe src="demo.html" height="300" width="300"> </iframe>

登入後複製

2. Target different targets using iframe

In HTML, we can use the target frame as a link using the iframe tag in the HTML document, and the target attribute to the link must refer to the name attribute of the iframe and sample code is as below:


<iframe src="demo.html" name="iframe1"> </iframe>
<p> <a href="www.google.com" target="iframe1"> Google.co.in </a> </p>

登入後複製

Tips and Tricks to Use HTML Commands

  • Make your visitors change the text color or background by adding extra code.
  • Add metadata while writing an HTML document.
  • It’s good to hide some fields where we don’t want a user to edit them.
  • Always add a horizontal line to break long sections so the website will look good.

Conclusion

Finally, it’s all about different types of HTML commands of various levels are briefly discussed with examples. After reading this article, I hope you will have a good idea of how to use HTML commands.

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

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