質問編集履歴

2

文面に補足しました

2019/04/02 06:32

投稿

Masskaz
Masskaz

スコア32

test CHANGED
File without changes
test CHANGED
@@ -9,6 +9,16 @@
9
9
  cssで新規登録画面のレイアウトを整えているところなのですが、フォームにcssが反映されず、困っております。
10
10
 
11
11
  やりたいことはフォーム同士の上下の間を空けたいです。
12
+
13
+
14
+
15
+ 補足
16
+
17
+ 反映されない箇所はitem_genreとitem_seasonです。
18
+
19
+ 下記コードのクラス名でf_attachmentと同じこともやってみたり、paddingやmarginも試しましたが、反映されませんでした。
20
+
21
+
12
22
 
13
23
 
14
24
 

1

htmlをコンソールのコードに変えました。cssのnew_itemは前の残りだったので消しました。

2019/04/02 06:31

投稿

Masskaz
Masskaz

スコア32

test CHANGED
File without changes
test CHANGED
@@ -24,61 +24,55 @@
24
24
 
25
25
  <div class="item_form">
26
26
 
27
- <%= form_for(@item_new) do |f| %>
27
+ <form class="new_item" id="new_item" enctype="multipart/form-data" action="/items" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="27SyRNY+pULIDvbw5kUDWaSmLLJxhp9iMbl6TiPgD0R7kiXk4le2nRGxBzT05fDNRE2vxZHuRKTl3Bal7k+0vQ==">
28
28
 
29
- <%= f.attachment_field :photo ,class: "f_attachment" %>
29
+ <input value="{}" data-reference="9a50990d1eeb89fca9df976edbc2fb4a" type="hidden" name="item[photo]"><input class="f_attachment" data-reference="9a50990d1eeb89fca9df976edbc2fb4a" include_hidden="false" type="file" name="item[photo]" id="item_photo">
30
30
 
31
31
  ▷ジャンル
32
32
 
33
+ <select name="item[genre]" id="item_genre">
34
+
35
+ <option value=""></option>
36
+
37
+             <option value="アウター">アウター</option>
38
+
39
+             <option value="トップス">トップス</option>
40
+
33
- <%= f.select :genre, [["",""],["アウター", "アウター"], ["トップス", "トップス"], ["ボトムス", "ボトムス"]],class: "f_genre" %><br>
41
+             <option value="ボトムス">ボトムス</option></select><br>
34
42
 
35
43
  ▷シーズン
36
44
 
37
- <%= f.radio_button :season, "春",class: "f_season" %> 春
45
+ <input class="f_season" type="radio" value="春" name="item[season]" id="item_season_春"> 春
38
46
 
39
- <%= f.radio_button :season, "夏",class: "f_season" %> 夏
47
+ <input class="f_season" type="radio" value="夏" name="item[season]" id="item_season_夏"> 夏
40
48
 
41
- <%= f.radio_button :season, "秋",class: "f_season" %> 秋
49
+ <input class="f_season" type="radio" value="秋" name="item[season]" id="item_season_秋"> 秋
42
50
 
43
- <%= f.radio_button :season, "冬",class: "f_season" %> 冬<br>
51
+ <input class="f_season" type="radio" value="冬" name="item[season]" id="item_season_冬"> 冬<br>
44
52
 
45
53
  ▷ブランド名
46
54
 
47
- <%= f.text_field :brand,class: "f_brand" %><br>
55
+ <input class="f_brand" type="text" name="item[brand]" id="item_brand"><br>
48
56
 
49
- <%= f.submit '保存' %>
57
+ <input type="submit" name="commit" value="保存" data-disable-with="保存">
50
58
 
51
- <% end %>
59
+           </form>
52
60
 
53
- </div>
61
+        </div>
54
62
 
55
- </div>
63
+ </div>
56
64
 
57
65
  ーーーーーーーーーーーーーーーーーーーーーーー
58
66
 
59
67
  【css】
60
-
61
- .new_item {
62
-
63
- width: 600px;
64
-
65
- height: 500px;
66
-
67
- margin: 0 auto;
68
-
69
- text-align: center;
70
-
71
- line-height: 20px;
72
-
73
- }
74
-
75
-
76
68
 
77
69
  .f_attachment{
78
70
 
79
71
  margin: 10px 190px 10px 190px;
80
72
 
81
73
  }
74
+
75
+
82
76
 
83
77
 
84
78