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

質問編集履歴

1

CSS追加

2021/01/12 10:01

投稿

pecchan
pecchan

スコア592

title CHANGED
File without changes
body CHANGED
@@ -5,7 +5,10 @@
5
5
  ```html
6
6
  <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
7
7
 
8
+ <form method="get" action="#" class="search_container">
9
+ <input type="text" placeholder="何かお探しですか?">
8
- <input type="submit" value="&#xf002">
10
+ <input type="submit" value="&#xf002" >
11
+ </form>
9
12
 
10
13
  ```
11
14
  ![イメージ説明](e75ef58876a3dad08b74386d232f2fc5.jpeg)
@@ -13,7 +16,10 @@
13
16
  変更
14
17
  ```html
15
18
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
19
+ <form method="get" action="#" class="search_container">
20
+ <input type="text" placeholder="何かお探しですか?">
16
- <input type="submit" value="&#xf002">
21
+ <input type="submit" value="&#xf002" >
22
+ </form>
17
23
 
18
24
  ```
19
25
  ![イメージ説明](79dc0cc9a247717c09fa46e9e513acdf.jpeg)
@@ -25,4 +31,61 @@
25
31
 
26
32
  どうすれば表示できるでしょうか?
27
33
 
28
- 分かる方教えて下さい。
34
+ 分かる方教えて下さい。
35
+
36
+
37
+ ###CSS追加
38
+ ご質問のおかげでfont-family:がバージョン4の指定だったと分かりました。
39
+ バージョン5の指定に変えてみました。
40
+ ```css
41
+ .search_container{
42
+ position: relative;
43
+ box-sizing: border-box;
44
+ border: 2px solid #ddd;
45
+ display: block;
46
+ /* margin: 3px 10px; */
47
+ border-radius: 3px;
48
+ height: 2.3em;
49
+ /* width: 265px; */
50
+ width: 100%;
51
+ /* overflow: hidden; */
52
+ background-color: #fff;
53
+ input[type="text"]{
54
+ width: 100%;
55
+ border: none;
56
+ height: 2.0em;
57
+ padding-left: 10px;
58
+ &:focus {
59
+ box-shadow: 0 0 12px 0 rgba(255,153,0,1);
60
+ border: 2px solid #FFF !important;
61
+ outline: 0;
62
+ }
63
+ }
64
+ input[type="submit"]{
65
+
66
+ cursor: pointer;
67
+ font-family: 'Font Awesome 5 Free'; /*バージョン4はFontAwesome;*/
68
+ border: none;
69
+ background: $mainColor2;
70
+ color: #fff;
71
+ position: absolute;
72
+ width: 3.5em;
73
+ height: 2.05em;
74
+ /* width: 50px; */
75
+ /* height: 41px; */
76
+ right: 0px;
77
+ top: 0;
78
+ outline : none;
79
+ text-align: center;
80
+ }
81
+ }
82
+
83
+
84
+
85
+
86
+ ```
87
+
88
+ ですが一色になってしまいました。
89
+ ![イメージ説明](41fab349a66bcc43c16a29871a512407.jpeg)
90
+
91
+ もう少し調べてみます。