2
1

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.

Bootstrapのnavのheightの罠

Posted at

Bootstrapを倒したかった

Bootstrapで遊んでいて、よくある左側固定のメニューを作ろうとしていました。

<div class="col-3 bg-dark">で左側作って

<ul class="nav flex-column">で縦並びにして

<li class="nav-item"><a class="nav-link" href="#">Link</a></li>とかなんとかしてそれっぽいものはできたのですが、思っていたのと違うじゃないか。

image.png

なぜそこで諦めた。

sassでしばく

仕方がないのでsassでしばいてやろうと思いました。sassでheight: 100%とかやりゃいけるやろ。

image.png

いけませんでした。意味がわからない。

(ちなみにsassはAtomにsass-autocompileをインスコしてセーブしたら自動でコンパイルしてくれるのがおすすめです。調べたらいくらでも出てきます)

いろいろ調べました

色々調べてみるとCSS3から使える魔法の単位vw(width用)とvh(height用)があるらしい。

なるほどとなったので、height: 100%height: 100vhとしてみました。

image.png

できました。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?