Block-Level vs. Inline Elements

本文深入解析HTML中的块级元素与内联元素的区别,包括它们的间距属性、排列方式以及如何在页面布局中应用。

http://www.ahuka.com/?page_id=119

A block-level element is an HTML tag (such as ptableh1 or div) that generates a break line. A block-level element has five spacing properties: heightwidthmarginborder and padding. An inline element, such as a span or anchor, doesn’t generate a break line and isn’t as flexible a container as a block-level element. A block-level element is not allowed inside an inline element. ... Top of the hierarchy is the div
tag. This tag can contain any other block-level element. But you cannot contain div inside another block-level element.

A partial list of each type of element

With the clues we now have, let’s compile a partial list of the elements on
each type. First, the block-level elements:

  • div
  • h1…h6
  • p
  • ul
  • ol
  • li
  • table
  • tr
  • td
  • th
  • blockquote

Now, the inline elements:

  • i
  • b
  • a href
  • a name
  • em
  • strong
  • q

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值