質問編集履歴

2

微修正

2022/12/06 03:02

投稿

arutoi
arutoi

スコア18

test CHANGED
File without changes
test CHANGED
@@ -5,7 +5,7 @@
5
5
  ### 実現したいこと
6
6
  https://codepen.io/Ireen/pen/yLEGxbG
7
7
  こちらにHTML、CSSのコードを記載しました。
8
- これをSafariで開くと以下のような状態になります。
8
+ これをSafari, iPhoneで開くと以下のような状態になります。
9
9
  ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-12-06/a619b5ab-0cb1-4107-8871-028069e70e6d.png)
10
10
 
11
11
 

1

コードの追加

2022/12/06 03:01

投稿

arutoi
arutoi

スコア18

test CHANGED
File without changes
test CHANGED
@@ -15,4 +15,63 @@
15
15
  同じようなtableが複数のページにいくつもあるため、固定で列の高さを指定する方法は除外で、
16
16
  「りんご」の部分の文章の高さが可変のため、CSSで解決したく、いいアイデアはないものか困っております。
17
17
 
18
+ ### コード
19
+ ```HTML
20
+ <table>
21
+ <tbody><tr>
22
+ <th rowspan="2">
23
+ りんご<br>
24
+ りんご<br>
25
+ りんご<br>
26
+ りんご<br>
27
+ りんご<br>
28
+ りんご<br>
29
+ </th>
30
+ <td class="one">バナナ</td>
31
+ <td class="two">みかん</td>
32
+ </tr>
33
+ <tr>
34
+ <td class="three">パイン</td>
35
+ <td class="two">オレンジ</td>
36
+ </tr>
37
+ </tbody>
38
+ </table>
39
+ ```
40
+
41
+ ```CSS
42
+ th, td{
43
+ border: 1px solid #000;
44
+ }
45
+
46
+ .one{
47
+ line-height: 80%;
48
+ font-size: 1.2rem;
49
+ padding: 20px 0;
50
+ width: 25%;
51
+ background: #f31e60;
52
+ color: white;
53
+ font-weight: bold;
54
+ text-align: center;
55
+ }
56
+
57
+ .two{
58
+ width: 25%;
59
+ font-weight: bold;
60
+ color: #000;
61
+ text-align: center;
62
+ font-size: 1.5rem;
63
+ }
64
+
65
+ .three{
66
+ line-height: 80%;
67
+ font-size: 1.2rem;
68
+ padding: 20px 0;
69
+ width: 25%;
70
+ background: #57abe7;
71
+ color: white;
72
+ font-weight: bold;
73
+ text-align: center;
74
+ }
75
+ ```
76
+
18
77
  よろしくお願いいたします。