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

質問編集履歴

2

CSSファイル追加

2021/02/24 08:15

投稿

TTTTaison
TTTTaison

スコア6

title CHANGED
File without changes
body CHANGED
@@ -171,4 +171,108 @@
171
171
  </body>
172
172
  </html>
173
173
 
174
+ ```
175
+
176
+ ```CSS
177
+ body {
178
+ font-size: .875rem;
179
+ }
180
+
181
+ .feather {
182
+ width: 16px;
183
+ height: 16px;
184
+ vertical-align: text-bottom;
185
+ }
186
+
187
+ /*
188
+ * Sidebar
189
+ */
190
+
191
+ .sidebar {
192
+ position: fixed;
193
+ top: 0;
194
+ /* rtl:raw:
195
+ right: 0;
196
+ */
197
+ bottom: 0;
198
+ /* rtl:remove */
199
+ left: 0;
200
+ z-index: 100; /* Behind the navbar */
201
+ padding: 48px 0 0; /* Height of navbar */
202
+ box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
203
+ }
204
+
205
+ @media (max-width: 767.98px) {
206
+ .sidebar {
207
+ top: 5rem;
208
+ }
209
+ }
210
+
211
+ .sidebar-sticky {
212
+ position: relative;
213
+ top: 0;
214
+ height: calc(100vh - 48px);
215
+ padding-top: .5rem;
216
+ overflow-x: hidden;
217
+ overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
218
+ }
219
+
220
+ .sidebar .nav-link {
221
+ font-weight: 500;
222
+ color: #333;
223
+ }
224
+
225
+ .sidebar .nav-link .feather {
226
+ margin-right: 4px;
227
+ color: #727272;
228
+ }
229
+
230
+ .sidebar .nav-link.active {
231
+ color: #007bff;
232
+ }
233
+
234
+ .sidebar .nav-link:hover .feather,
235
+ .sidebar .nav-link.active .feather {
236
+ color: inherit;
237
+ }
238
+
239
+ .sidebar-heading {
240
+ font-size: .75rem;
241
+ text-transform: uppercase;
242
+ }
243
+
244
+ /*
245
+ * Navbar
246
+ */
247
+
248
+ .navbar-brand {
249
+ padding-top: .75rem;
250
+ padding-bottom: .75rem;
251
+ font-size: 1rem;
252
+ background-color: rgba(0, 0, 0, .25);
253
+ box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
254
+ }
255
+
256
+ .navbar .navbar-toggler {
257
+ top: .25rem;
258
+ right: 1rem;
259
+ }
260
+
261
+ .navbar .form-control {
262
+ padding: .75rem 1rem;
263
+ border-width: 0;
264
+ border-radius: 0;
265
+ }
266
+
267
+ .form-control-dark {
268
+ color: #fff;
269
+ background-color: rgba(255, 255, 255, .1);
270
+ border-color: rgba(255, 255, 255, .1);
271
+ }
272
+
273
+ .form-control-dark:focus {
274
+ border-color: transparent;
275
+ box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
276
+ }
277
+
174
278
  ```

1

ファイル全体を掲載しました。

2021/02/24 08:15

投稿

TTTTaison
TTTTaison

スコア6

title CHANGED
File without changes
body CHANGED
@@ -2,10 +2,63 @@
2
2
 
3
3
  Bootstrapのテンプレートを使って試行錯誤をしているのですが、このようにサイドバーとメインバーが重なってしまいます。カードを三つ全体表示させたいのですが、どうしたらいいでしょう?
4
4
 
5
- #ソースコード
6
5
 
6
+
7
+ # 追記
8
+ こちらファイル全体になります。
7
9
  ```HTML
8
- サイドバー↓
10
+ <!doctype html>
11
+ <html lang="en">
12
+ <head>
13
+ <meta charset="utf-8">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1">
15
+ <meta name="description" content="">
16
+ <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
17
+ <meta name="generator" content="Hugo 0.80.0">
18
+ <title>Dashboard Template · Bootstrap v5.0</title>
19
+
20
+ <link rel="canonical" href="https://getbootstrap.com/docs/5.0/examples/dashboard/">
21
+
22
+
23
+
24
+ <!-- Bootstrap core CSS -->
25
+ <link href="../assets/dist/css/bootstrap.min.css" rel="stylesheet">
26
+
27
+ <style>
28
+ .bd-placeholder-img {
29
+ font-size: 1.125rem;
30
+ text-anchor: middle;
31
+ -webkit-user-select: none;
32
+ -moz-user-select: none;
33
+ user-select: none;
34
+ }
35
+
36
+ @media (min-width: 768px) {
37
+ .bd-placeholder-img-lg {
38
+ font-size: 3.5rem;
39
+ }
40
+ }
41
+ </style>
42
+
43
+
44
+ <!-- Custom styles for this template -->
45
+ <link href="dashboard.css" rel="stylesheet">
46
+ </head>
47
+ <body>
48
+
49
+ <header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
50
+ <a class="navbar-brand col-md-3 col-lg-2 me-0 px-3" href="#">Company name</a>
51
+ <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
52
+ <span class="navbar-toggler-icon"></span>
53
+ </button>
54
+ <input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
55
+ <ul class="navbar-nav px-3">
56
+ <li class="nav-item text-nowrap">
57
+ <a class="nav-link" href="#">Sign out</a>
58
+ </li>
59
+ </ul>
60
+ </header>
61
+
9
62
  <div class="container-fluid">
10
63
  <div class="row">
11
64
  <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
@@ -23,15 +76,38 @@
23
76
  Orders
24
77
  </a>
25
78
  </li>
26
- .....
27
- ```
28
- こちらはメインバーの記述になります
79
+ <li class="nav-item">
80
+ <a class="nav-link" href="#">
81
+ <span data-feather="shopping-cart"></span>
29
- ```HTML
82
+ Products
30
- <main>
83
+ </a>
84
+ </li>
85
+ <li class="nav-item">
86
+ <a class="nav-link" href="#">
87
+ <span data-feather="users"></span>
88
+ Customers
89
+ </a>
90
+ </li>
91
+ <li class="nav-item">
92
+ <a class="nav-link" href="#">
93
+ <span data-feather="bar-chart-2"></span>
94
+ Reports
95
+ </a>
96
+ </li>
97
+ <li class="nav-item">
98
+ <a class="nav-link" href="#">
99
+ <span data-feather="layers"></span>
100
+ Integrations
101
+ </a>
102
+ </li>
103
+ </ul>
104
+ </nav>
105
+
106
+ <main class="ml-20em">
31
107
  <div class="album py-5 bg-light">
32
108
  <div class="container">
33
109
 
34
- <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
110
+ <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3 ml-20em">
35
111
  <div class="col ml-2em">
36
112
  <div class="card shadow-sm">
37
113
  <svg class="bd-placeholder-img card-img-top" width="100%" height="225" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Thumbnail" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#55595c"/><text x="50%" y="50%" fill="#eceeef" dy=".3em">Thumbnail</text></svg>
@@ -85,4 +161,14 @@
85
161
  </div>
86
162
 
87
163
  </main>
164
+ </div>
165
+ </div>
166
+
167
+
168
+ <script src="../assets/dist/js/bootstrap.bundle.min.js"></script>
169
+
170
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js" integrity="sha384-zNy6FEbO50N+Cg5wap8IKA4M/ZnLJgzc6w2NqACZaK0u0FXfOWRRJOnQtpZun8ha" crossorigin="anonymous"></script><script src="dashboard.js"></script>
171
+ </body>
172
+ </html>
173
+
88
174
  ```