1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Overflow: hiddenではみ出した部分を隠す

Posted at

CSS の overflow

overflowとはCSSのプロパティの1つで「要素のボックスからはみ出た部分をどう扱うか」を指定する。

example.css

セレクタ {
  overflow: ;
}

visible:初期値。はみ出た部分が、はみ出たままの状態で表示される場合あり
hidden:はみ出た部分が隠れる
scroll:はみ出た部分が隠れてスクロールできる状態に
auto:ブラウザにより表示が変わる(基本的にはスクロールできる状態に)

overflow: visibleでそのまま表示

index.html
<p class="example">あいうえおあいうえおあいうえお</p>
app.css
.example {
  width: 50px;
  height: 50px;
  overflow: visible;
  background: skyblue;
}

スクリーンショット 2019-12-19 12.28.23.png

overflow: hiddenで非表示に

app.css

.example {
  width: 50px;
  height: 50px;
  overflow: hidden;
  background: skyblue;
}

スクリーンショット 2019-12-19 12.29.43.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?