質問編集履歴

1

質問内容

2017/02/17 02:27

投稿

takamiii_158cm
takamiii_158cm

スコア84

test CHANGED
File without changes
test CHANGED
@@ -12,16 +12,136 @@
12
12
 
13
13
 
14
14
 
15
+
16
+
17
+ 使用する状況は、アイコンの横に文章が並ぶレイアウトで
18
+
19
+ ・文言が1行で終わる時はアイコンに対して縦中央そろえ(vertical-align: middle)
20
+
21
+ ・文言が2行以上の場合、文言がtopに揃う(vertical-align: top)
22
+
23
+
24
+
25
+ というイメージです。。
26
+
27
+
28
+
29
+ ![イメージ説明](d537c15801980a9cbf5b44801dad8687.png)
30
+
31
+ ![イメージ説明](654de0d0dd26d8521f48400dff3e93de.png)
32
+
33
+
34
+
35
+ 2行以上になった場合、文言をアイコンの高さと揃えたいのにlineheightのせいで文言に上アキが出るので解消したいです。。
36
+
37
+
38
+
39
+
40
+
41
+ cssはシングルクラスで書いています。
42
+
43
+
44
+
45
+
46
+
15
47
  ###該当のソースコード
16
48
 
17
- ```css
18
49
 
19
- p {
20
50
 
21
- line-height: 2;
51
+ ```html
22
52
 
53
+ <div class="faqList__body__table">
54
+
55
+ <div class="faqList__body__icon"><span>A</span></div>
56
+
57
+ <p class="faqList__body__txt">この文章はダミーです。文字の大きさ、量、字間、</p>
58
+
23
- }
59
+ </div>
24
60
 
25
61
 
26
62
 
27
63
  ```
64
+
65
+
66
+
67
+ ```css
68
+
69
+ .faqList__body__table {
70
+
71
+ display: table;
72
+
73
+ }
74
+
75
+
76
+
77
+ .faqList__body__icon {
78
+
79
+ position: relative;
80
+
81
+ display: block;
82
+
83
+ margin-right: 20px;
84
+
85
+ width: 45px;
86
+
87
+ height: 45px;
88
+
89
+ border-radius: 23px;
90
+
91
+ float: left;
92
+
93
+ font-family: "Montserrat", "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "游ゴシック体", "Yu Gothic", "YuGothic", "メイリオ", "Meiryo", sans-serif;
94
+
95
+ font-weight: 700;
96
+
97
+ font-size: 1.28571rem;
98
+
99
+ line-height: 1.1;
100
+
101
+ background-color: #cb4e0c;
102
+
103
+ }
104
+
105
+
106
+
107
+ .faqList__body__icon > span {
108
+
109
+ content: "";
110
+
111
+ display: block;
112
+
113
+ text-align: center;
114
+
115
+ position: absolute;
116
+
117
+ margin-top: -10px;
118
+
119
+ padding: 0;
120
+
121
+ top: 50%;
122
+
123
+ left: 0;
124
+
125
+ right: 0;
126
+
127
+ color: #fff;
128
+
129
+ }
130
+
131
+
132
+
133
+ .faqList__body__txt {
134
+
135
+ display: table-cell;
136
+
137
+ font-size: 1.14286rem;
138
+
139
+ line-height: 2;
140
+
141
+ vertical-align: middle;
142
+
143
+ }
144
+
145
+
146
+
147
+ ```