13
11

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.

CSSAdvent Calendar 2017

Day 12

CSSで、内容がないときでもテキスト1行分の高さを確保する方法

Posted at

CSSで、内容がないときでもテキスト1行分の高さを確保するには、次のようにすればよい。

.container::before {
  content: "";
  display: inline-block;
}

デモ

未来

lhという単位が草案にある。1lhはテキスト1行分の高さに等しい。これが使用可能になれば、次のようにできるであろう。

.container {
  min-height: 1lh;
}
13
11
1

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
13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?