:每当我们想要以表格格式显示数据时,表格就是一个完美的解决方案。它将为您的 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.