【前端学习记录】(一) span 和 div 的区别

133 阅读1分钟

span 和 div 的区别

Definition and Usage

  1. The <span> tag is an inline container used to mark up a part of a text, or a part of a document.
  2. The <span> tag is easily styled by CSS or manipulated with JavaScript using the class or id attribute.
  3. The <span> tag is much like the <div>(www.w3schools.com/tags/tag_di…) element, but<div>is a block-level element and <span> is an inline element.

<span> 设置宽高无效, <div>设置高度有效