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

質問編集履歴

1

質問内容

2017/02/17 02:27

投稿

takamiii_158cm
takamiii_158cm

スコア84

title CHANGED
File without changes
body CHANGED
@@ -5,10 +5,70 @@
5
5
 
6
6
  ![イメージ説明](5f27be713b928cdd5c6db087abcc2ab3.jpeg)
7
7
 
8
+
9
+ 使用する状況は、アイコンの横に文章が並ぶレイアウトで
10
+ ・文言が1行で終わる時はアイコンに対して縦中央そろえ(vertical-align: middle)
11
+ ・文言が2行以上の場合、文言がtopに揃う(vertical-align: top)
12
+
13
+ というイメージです。。
14
+
15
+ ![イメージ説明](d537c15801980a9cbf5b44801dad8687.png)
16
+ ![イメージ説明](654de0d0dd26d8521f48400dff3e93de.png)
17
+
18
+ 2行以上になった場合、文言をアイコンの高さと揃えたいのにlineheightのせいで文言に上アキが出るので解消したいです。。
19
+
20
+
21
+ cssはシングルクラスで書いています。
22
+
23
+
8
24
  ###該当のソースコード
25
+
26
+ ```html
27
+ <div class="faqList__body__table">
28
+ <div class="faqList__body__icon"><span>A</span></div>
29
+ <p class="faqList__body__txt">この文章はダミーです。文字の大きさ、量、字間、</p>
30
+ </div>
31
+
32
+ ```
33
+
9
34
  ```css
10
- p {
35
+ .faqList__body__table {
11
- line-height: 2;
36
+ display: table;
12
- }
37
+ }
13
38
 
39
+ .faqList__body__icon {
40
+ position: relative;
41
+ display: block;
42
+ margin-right: 20px;
43
+ width: 45px;
44
+ height: 45px;
45
+ border-radius: 23px;
46
+ float: left;
47
+ font-family: "Montserrat", "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "游ゴシック体", "Yu Gothic", "YuGothic", "メイリオ", "Meiryo", sans-serif;
48
+ font-weight: 700;
49
+ font-size: 1.28571rem;
50
+ line-height: 1.1;
51
+ background-color: #cb4e0c;
52
+ }
53
+
54
+ .faqList__body__icon > span {
55
+ content: "";
56
+ display: block;
57
+ text-align: center;
58
+ position: absolute;
59
+ margin-top: -10px;
60
+ padding: 0;
61
+ top: 50%;
62
+ left: 0;
63
+ right: 0;
64
+ color: #fff;
65
+ }
66
+
67
+ .faqList__body__txt {
68
+ display: table-cell;
69
+ font-size: 1.14286rem;
70
+ line-height: 2;
71
+ vertical-align: middle;
72
+ }
73
+
14
74
  ```