當前位置:編程學習大全網 - 遊戲軟體 - html中label是塊級標簽嗎?

html中label是塊級標簽嗎?

在頁面布局中,壹般會將html元素分為兩種,即塊級元素和行內元素。label為行內元素,不是塊級元素。塊級元素默認占壹行高度,壹行內有壹個塊級元素後壹般無法添加其他元素,除非添加了float浮動。兩個塊級元素連續放置時,會在另起壹行。塊級元素壹般可嵌套塊級元素或行內元素。最直觀的體現如下:

<!DOCTYPE?html>

<html>

<head>?

<meta?charset="utf-8">?

<title>測試label標簽</title>?

</head>

<body>

<p?style="border-bottom:1px?solid?#ccc;color:red;padding-bottom:10px;margin-bottom:40px">測試label標簽</p>

<label?for="male">label標簽</label>

<span?style="background-color:#ccc;padding:10px;margin-right:10px">分割</span>

<label?for="male">label標簽</label>

</body>

</html>

顯示效果:

可見,兩個label並沒有換行顯示。

  • 上一篇:中國好聲音李安現在在幹嘛
  • 下一篇:神槍之倒刺千尾蠍是誰
  • copyright 2024編程學習大全網