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

質問編集履歴

1

ご指摘ありがとうございます。HTMLとCSSの全文を載せました。また、プロジェクトの構造については、全てのフォルダーを開いた状態でキャプチャしたものを貼り付けております。

2019/08/14 06:06

投稿

merukapu
merukapu

スコア3

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,6 @@
1
+ ```
2
+ コード
1
- ### 前提・実現したいこと
3
+ ```### 前提・実現したいこと
2
4
  cssで背景画像を設置したいです。あと、Boostrapを使用しています。
3
5
 
4
6
 
@@ -11,7 +13,39 @@
11
13
  ### 該当のソースコード
12
14
 
13
15
  ```html
14
- <main>
16
+ <!doctype html>
17
+ <html lang="ja">
18
+ <head>
19
+ <!-- Required meta tags -->
20
+ <meta charset="utf-8">
21
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
22
+
23
+ <!-- Bootstrap CSS -->
24
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
25
+ <link href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" rel="stylesheet">
26
+ <link rel="stylesheet" href="css/styles.css">
27
+ <title>現地の人から借りる家、体験&スポット - Airbnb</title>
28
+ </head>
29
+ <body>
30
+ <header class="px-1 ">
31
+ <section class="menu">
32
+ <div class="logo" >
33
+ <img src="img/logo.png" width="34" height="34" alt="Airbnbのロゴ">
34
+ </div>
35
+ <div class="harrow">
36
+ <i class="fas fa-angle-down"></i>
37
+ </div>
38
+ </section>
39
+ <section class="header-right">
40
+ <div class="input-group mb-3">
41
+ <div class="input-group-prepend srch">
42
+ <span class="input-group-text" id="basic-addon1"><i class="fas fa-search"></i></span>
43
+ </div>
44
+ <input type="text" class="form-control" placeholder="探す" aria-label="Username" aria-describedby="basic-addon1">
45
+ </div>
46
+ </section>
47
+ </header>
48
+ <main>
15
49
  <div class="mainto">
16
50
  <div class="container">
17
51
  <div class="va-middle">
@@ -23,16 +57,70 @@
23
57
  </div>
24
58
  </div>
25
59
  </main>
60
+ <!-- Optional JavaScript -->
61
+ <!-- jQuery first, then Popper.js, then Bootstrap JS -->
62
+ <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
63
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
64
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
65
+ </body>
66
+ </html>
26
67
 
68
+ ```
69
+
70
+ ```css
71
+ body{
72
+ font-family: Circular, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, sans-serif;
73
+ font-size:14px;
74
+ color:#484848;
75
+ line-height:1.43;
76
+ }
77
+ /* header */
78
+ header{
79
+ display:flex;
80
+ }
81
+ .menu{
82
+ width:100px;
83
+ height:64px !important;
84
+ padding:15px 22px;
85
+
86
+ }
87
+ .logo{
88
+ position:relative;
89
+ }
90
+ .harrow{
91
+ position:absolute;
92
+ top:20px;
93
+ left:68px
94
+ }
95
+ .header-right{
96
+ margin-top:12px;
97
+ flex-grow: 3;
98
+ }
99
+ .input-group{
100
+ box-shadow:rgba(220, 220, 220, 1) 0px 2px 4px !important;
101
+ margin-bottom:12px;
102
+ height:48px;
103
+ width:100%;
104
+ }
105
+ .input-group-text{
106
+ background:#fff;
107
+ }
108
+ .form-control{
109
+ height:48px;
110
+ }
111
+
27
- ーーーーここからmaintoクラスのcssです。ーーーーーー
112
+ /* main */
28
113
  .mainto{
114
+ height:500px;
29
115
  background:url(img/picture1.png);
30
116
  background-size:cover;
31
117
  }
118
+
32
119
  ```
33
120
 
34
121
  ### 試したこと
35
122
 
36
123
  maintoクラスのついているdivにbackground="uel(~)"と書いてみても背景画像は現れませんでした。また、mainタグに同じことをしても反映されませんでした。
37
124
 
38
- ### 補足情報(FW/ツールのバージョン)
125
+ ### 補足情報(FW/ツールのバージョン)
126
+ ![イメージ説明](a35fcf3fea16111ab39cf262a8dc2e17.png)