回答編集履歴

3

▶︎

2022/10/19 09:07

投稿

Cocode
Cocode

スコア2314

test CHANGED
@@ -18,6 +18,14 @@
18
18
  ---
19
19
 
20
20
  「すべてを見る」を右揃えにしました&いくつか修正しました。
21
+
22
+ ```html
23
+ <li class="news-button">
24
+ <a class="news-container-list-button" href="#">すべて見る</a>
25
+ <!-- <a class="news-container-list-button-triangle" href="#">▶︎</a> -->
26
+ </li>
27
+ ```
28
+ ↑htmlから▶︎削除
21
29
 
22
30
  ```css
23
31
  /* ニュース */
@@ -104,16 +112,23 @@
104
112
  }
105
113
 
106
114
  .news-container-list-button {
115
+ position: relative; /* 追加 */
107
116
  color: #444444;
108
117
  font-size: 16px;
109
118
  line-height: 38px;
110
119
  max-width: 1048px;
111
- margin-right: 7.52px;
112
120
  }
113
121
 
122
+ /* 追加 */
123
+ .news-container-list-button::before {
124
+ content: "▶︎";
125
+ position: absolute;
126
+ right: -1.2em;
127
+ }
128
+
114
- .news-container-list-button-triangle {
129
+ /* .news-container-list-button-triangle {
115
130
  color: #444444;
116
- }
131
+ } */
117
132
 
118
133
 
119
134
 
@@ -168,3 +183,4 @@
168
183
 
169
184
  }
170
185
  ```
186
+ ↑疑似要素で▶︎配置

2

css

2022/10/17 13:37

投稿

Cocode
Cocode

スコア2314

test CHANGED
@@ -14,3 +14,157 @@
14
14
  word-break: break-all; */
15
15
  }
16
16
  ```
17
+
18
+ ---
19
+
20
+ 「すべてを見る」を右揃えにしました&いくつか修正しました。
21
+
22
+ ```css
23
+ /* ニュース */
24
+
25
+ .news {
26
+ padding-bottom: 112px;
27
+ background-color: #F5FCF8;
28
+ }
29
+
30
+ .news-container {
31
+ max-width: 1180px;
32
+ height: auto;
33
+ margin: 0 auto;
34
+ background: #FFFFFF 0% 0% no-repeat padding-box;
35
+ box-shadow: 0px 3px 6px #00000029;
36
+ border-radius: 30px;
37
+ opacity: 1;
38
+ list-style: none outside;
39
+ padding-top: 39px;
40
+ padding-bottom: 46px;
41
+ padding-left: 0;
42
+ width: 95%;
43
+ }
44
+
45
+ h5 {
46
+ font-size: 24px;
47
+ background: linear-gradient(transparent 70%, #99E5A5 70%);
48
+ max-width: 96px;
49
+ margin: 82px auto 70px;
50
+ line-height: 38px;
51
+
52
+ }
53
+
54
+ .news-container-list {
55
+ max-width: 1048px;
56
+ margin: 0 auto;
57
+ width: 90%;
58
+ }
59
+
60
+ .news-container .news-container-list a {
61
+ border-bottom: 2px solid #E7E7E7;
62
+ display: flex;
63
+ align-items: center;
64
+ flex-wrap: nowrap;
65
+ text-decoration: none;
66
+ /* padding: 19.5px 33px 19.5px 0; */
67
+ padding: 19.5px 0;
68
+ }
69
+
70
+ time {
71
+ font-size: 16px;
72
+ color: #21A937;
73
+ }
74
+
75
+ .news span {
76
+ background-color: #444444;
77
+ width: 80px;
78
+ height: 25px;
79
+ line-height: 25px;
80
+ margin-right: 30px;
81
+ margin-left: 30px;
82
+ text-align: center;
83
+ color: #FFFFFF;
84
+ font-size: 12px;
85
+ flex-shrink: 0;
86
+ }
87
+
88
+ .news-container-list p {
89
+ font-size: 16px;
90
+ color: #444444;
91
+ white-space: nowrap;
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+
95
+ }
96
+
97
+ .news-button {
98
+ width: 90%; /* 追加 */
99
+ margin: 0 auto; /* 追加 */
100
+ text-align: right;
101
+ max-width: 1121px;
102
+ padding-top: 39.5px;
103
+
104
+ }
105
+
106
+ .news-container-list-button {
107
+ color: #444444;
108
+ font-size: 16px;
109
+ line-height: 38px;
110
+ max-width: 1048px;
111
+ margin-right: 7.52px;
112
+ }
113
+
114
+ .news-container-list-button-triangle {
115
+ color: #444444;
116
+ }
117
+
118
+
119
+
120
+ /* モバイル版
121
+ ----------------------------------*/
122
+
123
+ @media (max-width: 1140px) {
124
+
125
+ /* ニュース */
126
+ .news-button {
127
+ /* padding-right: 2%; */
128
+ }
129
+ }
130
+
131
+ @media (max-width: 860px) {
132
+
133
+
134
+ /* ニュース */
135
+
136
+ .news-container .news-container-list a {
137
+ flex-direction: column;
138
+ justify-content: start;
139
+ flex-wrap: wrap;
140
+ display: block;
141
+
142
+ text-align: left;
143
+ }
144
+
145
+
146
+ .news-container-list p {
147
+ width: 100%;
148
+ /* max-width: 300px; */
149
+ white-space: normal;
150
+ /* overflow:initial;
151
+ overflow-wrap: break-word;
152
+ word-break: break-word;
153
+ word-break: break-all; */
154
+ }
155
+
156
+ .news-container-list {
157
+ /* max-width: 300px; */
158
+ }
159
+
160
+ .news span {
161
+ display: inline-block;
162
+ }
163
+
164
+ .news-button {
165
+ /* padding-right: 2%; */
166
+ }
167
+
168
+
169
+ }
170
+ ```

1

css

2022/10/17 08:16

投稿

Cocode
Cocode

スコア2314

test CHANGED
@@ -1,6 +1,6 @@
1
1
  PCのときに`white-space: nowrap;`をつけているので、Tab・SPのときは`white-space: normal;`にしてやると改行できます。
2
2
 
3
- ```
3
+ ```css
4
4
  @media (max-width: 860px) {
5
5
 
6
6
  /* 中略 */