質問編集履歴

2

質問文章の訂正

2021/04/19 13:42

投稿

sanayaaan
sanayaaan

スコア25

test CHANGED
@@ -1 +1 @@
1
- スイッチボタンの大きさ指定とbootstrapflex
1
+ bootstrap flexの幅指定が効かない
test CHANGED
@@ -1,24 +1,30 @@
1
+ ### 前提・実現したいこと
2
+
3
+
4
+
1
- 下記コードにあるスイッチボタン大きさ少し大きくして、イメージようにいのですが、どうもうまくいきません。
5
+ bootstrapflex用いて、横並び実装をのですが、1つのcolのみ、幅指定が効きません。
2
-
6
+
3
- イッチボタンがcontainer-fluidからはみ出してしまっている状態です
7
+ 幅を大きくしたい要素は、全ソーコードのうち、下記の部分となるのです、```col-2```を```col-3```にして、```row```の中が全部で12になるよう他の要素を小さく設定ても、幅が大きくなりせん
8
+
9
+
10
+
4
-
11
+ ```
5
-
6
-
12
+
7
- ![イメージ説明](07402ce11f3ad73b17d17773b999a13d.png)
13
+ <div class="row col-2 custom-control custom-switch custom-switch-radio-position switch-btn">
14
+
8
-
15
+   <input type="checkbox" class="custom-control-input col-4" id="customSwitch1"data-toggle="collapse" data-target="#collapseExample" aria-expanded="true"aria-controls="collapseExample">
16
+
9
-
17
+   <label class="custom-control-label text-left font-1 col-8" for="customSwitch1">検索ボタン</label>
10
-
18
+
11
- ①スイッチボタンを大きくする方法
19
+ </div>
12
-
20
+
13
- ②イメージのように綺麗な横並びにする方法 
21
+ ```
14
-
15
-
16
-
17
- を教えて頂きたく、お分かりになる方がいらっしゃれば助けていただけますと幸いです。
22
+
18
-
19
- (コードが長くてみません。)
23
+ 下記全ソースコードの一番はじめのcolです。)
24
+
25
+
26
+
20
-
27
+ ### 全ソースコード
21
-
22
28
 
23
29
  ```html
24
30
 
@@ -30,7 +36,7 @@
30
36
 
31
37
  <section id="search">
32
38
 
33
- <form class="" id="" action="/projects" accept-charset="UTF-8" method="get">
39
+ <form class="id=" action="/projects" accept-charset="UTF-8" method="get">
34
40
 
35
41
  <div class="container-fluid">
36
42
 
@@ -180,107 +186,7 @@
180
186
 
181
187
  </div>
182
188
 
183
- </div>
184
-
185
- <div class="row search-content">
186
-
187
- <div class="col-2">
188
-
189
- <div class="form-group row">
190
-
191
- <label
192
-
193
- class="badge badge-secondary border border-2 border-secondary rounded-0 col-form-label font-1 color-1 col-6 d-flex align-items-center justify-content-center">発注元</label>
194
-
195
- <select
196
-
197
- class="form-control form-control-sm font-1 col-6 border border-2 border-secondary rounded-0 "
198
-
199
- name="">
200
-
201
- <option value="">全て</option>
202
-
203
- </select>
204
-
205
- </div>
206
-
207
- </div>
208
-
209
- <div class="col-2">
210
-
211
- <div class="form-group row">
212
-
213
- <label
214
-
215
- class="badge badge-secondary border border-secondary rounded-0 col-form-label col-2 font-1 color-1 col-6 d-flex align-items-center justify-content-center">仕入先</label>
216
-
217
- <select
218
-
219
- class="form-control form-control-sm font-1 col-6 border border-2 border-secondary rounded-0 "
220
-
221
- name="">
222
-
223
- <option value="">全て</option>
224
-
225
- </select>
226
-
227
- </div>
228
-
229
- </div>
230
-
231
- <div class="col-2">
232
-
233
- <div class="form-group row">
234
-
235
- <label
236
-
237
- class="badge badge-secondary border border-secondary rounded-0 col-form-label font-1 color-1 col-6 d-flex align-items-center justify-content-center">作業担当者</label>
238
-
239
- <select
240
-
241
- class="form-control form-control-sm font-1 col-6 border border-2 border-secondary rounded-0 "
242
-
243
- name="">
244
-
245
- <option value="">全て</option>
246
-
247
- </select>
248
-
249
- </div>
250
-
251
- </div>
252
-
253
- <div class="col-5">
254
-
255
- <div class="form-group">
256
-
257
- <input class="form-control form-control-sm" placeholder="Search" type="text"
258
-
259
- name="q[name_or_creator_name_or_company_name_cont]"
260
-
261
- id="q_name_or_creator_name_or_company_name_cont">
262
-
263
- </div>
264
-
265
- </div>
266
-
267
- <div class="col-1 row">
268
-
269
- <label class="font-1 align-items-center justify-content-center">表示件数:</label>
270
-
271
- <select class="form-control form-control-sm col-4 font-1 align-items-center" name="">
272
-
273
- <option value="">10</option>
274
-
275
- <option value="0">20</option>
276
-
277
- <option value="1">30</option>
278
-
279
- </select>
280
-
281
- </div>
282
-
283
- </div>
189
+ </div>
284
190
 
285
191
  </div>
286
192
 
@@ -296,51 +202,21 @@
296
202
 
297
203
  ```css
298
204
 
299
- /* フォントサイズ指定 */
205
+
300
-
301
- .font-1 {
206
+
302
-
303
- font-size: 0.7rem;
304
-
305
- }
306
-
307
-
308
-
309
- /* ボーダー削除 */
310
-
311
- .border-none {
312
-
313
- border: none;
314
-
315
- }
316
-
317
-
318
-
319
- /* inputのボーダー削除 */
320
-
321
- input {
322
-
323
- outline: none;
324
-
325
- }
326
-
327
-
328
-
329
- /* 検索スイッチ */
207
+ /* 検索ボタン */
330
208
 
331
209
  .custom-switch {
332
210
 
333
211
  padding-left: 2.25rem;
334
212
 
335
- padding-bottom: 1rem;
336
-
337
213
  }
338
214
 
339
215
 
340
216
 
341
217
  .switch-btn {
342
218
 
343
- max-width: 9% !important;
219
+ max-width: 8% !important;
344
220
 
345
221
  padding-left: 3rem;
346
222
 
@@ -350,7 +226,7 @@
350
226
 
351
227
  .custom-switch {
352
228
 
353
- padding-left: 2.25rem;
229
+ padding-left: 4rem;
354
230
 
355
231
  }
356
232
 
@@ -364,13 +240,123 @@
364
240
 
365
241
  display: block;
366
242
 
367
- min-height: 1.5rem;
243
+ min-height: 2rem;
368
-
244
+
369
- padding-left: 1.5rem;
245
+ padding-left: 3.5rem;
246
+
370
-
247
+ }
248
+
249
+
250
+
251
+ .custom-switch .custom-control-label::before {
252
+
253
+ left: -2.25rem;
254
+
255
+ width: 2.9rem;
256
+
371
- -webkit-print-color-adjust: exact;
257
+ pointer-events: all;
372
-
258
+
373
- color-adjust: exact;
259
+ border-radius: 1rem;
260
+
261
+ }
262
+
263
+ .custom-control-label::before,
264
+
265
+ .custom-file-label,
266
+
267
+ .custom-select {
268
+
269
+ transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
270
+
271
+ box-shadow 0.15s ease-in-out;
272
+
273
+ }
274
+
275
+ .custom-control-label::before {
276
+
277
+ position: absolute;
278
+
279
+ top: 0.25rem;
280
+
281
+ left: -1.5rem;
282
+
283
+ display: block;
284
+
285
+ width: 2rem;
286
+
287
+ height: 1.75rem;
288
+
289
+ pointer-events: none;
290
+
291
+ content: "";
292
+
293
+ background-color: #fff;
294
+
295
+ border: #adb5bd solid 1px;
296
+
297
+ }
298
+
299
+
300
+
301
+ .custom-switch .custom-control-input:checked ~ .custom-control-label::after {
302
+
303
+ background-color: #fff;
304
+
305
+ -webkit-transform: translateX(0.75rem);
306
+
307
+ transform: translateX(1.1rem);
308
+
309
+ }
310
+
311
+
312
+
313
+ .custom-switch .custom-control-label::after {
314
+
315
+ top: calc(0rem + 6px);
316
+
317
+ left: calc(-2.25rem + 2px);
318
+
319
+ width: calc(1.75rem - 4px);
320
+
321
+ height: calc(1.75rem - 4px);
322
+
323
+ background-color: #adb5bd;
324
+
325
+ border-radius: 1rem;
326
+
327
+ transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
328
+
329
+ box-shadow 0.15s ease-in-out, -webkit-transform 0.15s ease-in-out;
330
+
331
+ transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out,
332
+
333
+ border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
334
+
335
+ transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out,
336
+
337
+ border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out,
338
+
339
+ -webkit-transform 0.15s ease-in-out;
340
+
341
+ }
342
+
343
+ .custom-control-label::after {
344
+
345
+ position: absolute;
346
+
347
+ top: 0.25rem;
348
+
349
+ left: -1.5rem;
350
+
351
+ display: block;
352
+
353
+ width: 1rem;
354
+
355
+ height: 1rem;
356
+
357
+ content: "";
358
+
359
+ background: no-repeat 50%/50% 50%;
374
360
 
375
361
  }
376
362
 
@@ -384,4 +370,32 @@
384
370
 
385
371
  }
386
372
 
373
+
374
+
375
+ /* 検索欄調整 */
376
+
377
+ .search-content {
378
+
379
+ margin-top: 1rem;
380
+
381
+ margin-right: 1rem;
382
+
383
+ margin-left: 1rem;
384
+
385
+ }
386
+
387
387
  ```
388
+
389
+
390
+
391
+ ### 試したこと
392
+
393
+
394
+
395
+ ```col-2```を```col-3```に変更をして、他の要素のcolを小さくして、rowが12になるように設定をしても、要素の幅自体が広くなりませんでした。
396
+
397
+
398
+
399
+ 全体が左に寄ってしまっていることも何か関係があるのでしょうか・・。
400
+
401
+ お助けいただけますと幸いです。

1

画像追加

2021/04/19 13:42

投稿

sanayaaan
sanayaaan

スコア25

test CHANGED
File without changes
test CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
 
6
6
 
7
+ ![イメージ説明](07402ce11f3ad73b17d17773b999a13d.png)
8
+
9
+
10
+
7
11
  ①スイッチボタンを大きくする方法
8
12
 
9
13
  ②イメージのように綺麗な横並びにする方法