什么是 HTML 页面中的水平规则?


<hr> 标记定义了在HTML页面中的一个中断,或者用于使用水平线分隔 HTML 页面中的内容,并通常显示为一条水平规则线。

<hr> 标记定义了在 HTML 页面中使用横线的断点。<hr> 标记是一个空元素。它仅有一个打开标签,即<hr>

语法

以下是<hr> 标记的语法。

<hr>...

示例

以下是使用<hr> 标记来分隔网页上内容的示例程序。

<!DOCTYPE html> <html> <body> <h3>LOK SABHA</h3> <p>Lok Sabha is composed of representatives of the people chosen by direct election.<br> The maximum strength of the House of the Constitution is 552, <br> which is made up by election of upto 530 members to represent the States,<br> upto 20 members to represent the Union Territories and not more than two members of the<br> Anglo-Indian Community to be nominated by the Hon'ble President.</p> <hr> <p> After coming into effect of The Constitution Act, 2019<br> the provision of special representation <br>of the Anglo-Indian community in the House of the People by nomination has not been extended further.</p> <hr> <p>The total elective membership is distributed among the States in such a way<br> that the ratio between the number of seats allotted to each State and the population of the State is,<br>so far as practicable, the same for all States.</p> <hr> </body> </html>

我们还可以在hr 标记中添加样式。

示例

以下是向<hr> 标记添加样式的示例程序。

<!DOCTYPE html> <html> <body> <h3>LOK SABHA</h3> <p>Lok Sabha is composed of representatives of the people chosen by direct election. <br> The maximum strength of the House of the Constitution is 552,<br> which is made up by election of upto 530 members to represent the States, <br> upto 20 members to represent the Union Territories and not more than two members of the<br> Anglo-Indian Community to be nominated by the Hon'ble President.</p> <hr style="height:10px;"> </body> </html>

示例

以下是向<hr> 标记添加样式的示例程序。

<!DOCTYPE html> <html> <body> <h3>LOK SABHA</h3> <p>Lok Sabha is composed of representatives of the people chosen by direct election. <br> The maximum strength of the House of the Constitution is 552,<br> which is made up by election of upto 530 members to represent the States,<br> upto 20 members to represent the Union Territories and not more than two members of the<br> Anglo-Indian Community to be nominated by the Hon'ble President.</p> <hr style="height:8px;background-color:gray"> </body> </html>

更新日期:2023 年 11 月 21 日

1K+ 浏览量

开启你的 职业生涯

通过完成课程获得认证

开始
广告