teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

コード追記

2021/10/20 06:51

投稿

hatena19
hatena19

スコア34367

answer CHANGED
@@ -5,4 +5,37 @@
5
5
 
6
6
  Bootstrapで絶対配置する場合は下記を参考にすればいいでしょう。
7
7
 
8
- [位置ユーティリティ~Bootstrap5設置ガイド](https://bootstrap-guide.com/utilities/position)
8
+ [位置ユーティリティ~Bootstrap5設置ガイド](https://bootstrap-guide.com/utilities/position)
9
+
10
+ ```html
11
+ <main class="h-100">
12
+ <div class="page-wrapper h-100 w-100">
13
+ <!-- トップバー -->
14
+ <nav class="navbar px-3 py-5 bg-light border-bottom shadow-sm position-static justify-content-center">
15
+ <div class="navbar-brand toggle-menu position-absolute start-0">
16
+ <button class="btn btn-light btn-sm" id="sidebarToggler">
17
+ <i class="fas fa-bars fa-lg" id="sidebarTogglerFa"></i>
18
+ </button>
19
+ </div>
20
+ <!-- 中央画像 -->
21
+ <div class="nav-item-image ml-3 text-muted">
22
+ <img src="https://placehold.jp/200x50.png" width="200" height="50" alt="サンプル">
23
+ </div>
24
+ <ul class="navbar-nav d-flex flex-row position-absolute end-0">
25
+ <li class="nav-item-underline ml-3 text-muted">
26
+ <a class="p-2 link-secondary" href="#" style="text-decoration:none;">ABOUT</a>
27
+ </li>
28
+ <li class="nav-item-underline ml-3 text-muted">
29
+ <a class="p-2 link-secondary" href="#" style="text-decoration:none;">CONTACT</a>
30
+ </li>
31
+ <li class="nav-item-login mx-3 text-muted">
32
+ LOGIN
33
+ </li>
34
+ </ul>
35
+ </nav>
36
+ <!-- トップバー -->
37
+ </div>
38
+ </main>
39
+ ```
40
+
41
+ [CodePenサンプル](https://codepen.io/hatena19/pen/xxLOedY)