Skip to content

Showing and hiding (display) · ⁨显示与隐藏(display)⁩

English

How boxes flow

  • Some elements are block: they stack on top of each other and fill the width — <div>, <p>, <h1>.
  • Some are inline: they sit side by side, taking only as much room as they need — <span>, <a>, <strong>.
  • display lets you change which way an element behaves.

中文

盒子是怎么排的

  • 有些元素是块级(block):它们一个叠一个,并占满整行 —— <div>、<p>、<h1>。
  • 有些是行内(inline):它们并排在一行里,只占用需要的宽度 —— <span>、<a>、<strong>。
  • display 让你改变一个元素的排法。

block 元素各占一行往下叠,inline 元素并排排列,none 隐藏元素

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩