:每當我們想要以表格格式顯示資料時,表格就是一個完美的解決方案。它將為您的 HTML 文件建立一個表格。
如果您想在 HTML 文件中包含視訊內容,那麼也可以在程式碼中使用簡單的視訊元素。
:如果使用者想要顯示項目列表,則可以使用
元素。
:依序顯示清單。
:
它將以無序的方式顯示清單。
:
此元素用於以描述清單的格式描述不同的術語。
HTML 區塊範例
以下是一些 HTML 區塊的範例:
範例#1
在下面的範例中,我們將使用一些基本的 Html 區塊元素,如 div、p、標題、帶有有序和無序列表的清單元素等。
代碼:
<html>
<head>
<title>HTML Block Level Elements </title>
</head>
<body>
<h1>HTML Block Level Elements </h1>
<p>This is the example of HTML block elements showing multiple block
level elements enclosed within it .Here we can also use inline elements too
</p>
<div>
<h3>Example including div , p , headings elements, list elements</h3>
<p>This example shows different kind of HTML block elements like div, p
, headings in between h1 to h6 </p>
</div>
<h2>Example of Lists</h2>
<h4>An Unordered HTML List showing Countries </h4>
<ul>
<li>Mumbai</li>
<li>Pune</li>
<li>Nagpur</li>
</ul>
<h4>An Ordered HTML List showing Countries</h4>
<ol>
<li>Mumbai</li>
<li>Pune</li>
<li>Nagpur</li>
</ol>
</body>
</html>
登入後複製
輸出:
Example #2
Here we will see another example in which we are creating a table.
Now by using HTML blocks elements, we are going to create an HTML form as follows:
Code:
<!DOCTYPE html>
<html>
<head>
<title>Password Input Control</title>
</head>
<body >
<form >
<h2>Welcome to HTMl Block Demo</h2>
<h4>Please login here</h4>
User ID : <input type = "text" name = "user_id" />
<br><br>
Password: <input type = "password" name = "password" />
<br><br>
<input type = "checkbox" name = "remember" value = "on"> Remember Me
<br><br>
<input type = "submit" name = "Login" value = "Submit" />
</form>
</body>
</html>
登入後複製
Output:
Example #4
Here we are trying to Address the element in HTML blocks.
Code:
<address>
Presented BY <a href="mailto:[email protected]">Narendra Modi</a>.<br>
Visit us at:Delhi<br>
primeminister.com<br>
Box 104, Red Fort<br>
Delhi
</address>
登入後複製
Output:
Conclusion
The above information concluded that the HTML blocks level element included in the HTML document’s body. It will create some large HTML blocks of sections like paragraphs or pages with the division. One can include another block-level element into the block-level elements. It’s also possible to include inline elements into the block-level element but including block-level elements into the inline elements is not possible.