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

質問編集履歴

3

test.cssと表記

2018/02/23 07:04

投稿

riohik
riohik

スコア12

title CHANGED
File without changes
body CHANGED
@@ -35,6 +35,7 @@
35
35
  </html>
36
36
  ```
37
37
 
38
+ test.cssの内容です
38
39
  ```css
39
40
  @charset "UTF-8";
40
41
 

2

現在状況の画像を追記しました

2018/02/23 07:04

投稿

riohik
riohik

スコア12

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,4 @@
1
- htmlページで文章が一定の長さを超えたとき、改行させたいのですが、
1
+ ![イメージ説明](830a22fcc0129482cf05445f38a37702.png)htmlページで文章が一定の長さを超えたとき、改行させたいのですが、
2
2
  改行すると、二行目が一行目があった位置に来てしまい、一行目だったものが上方向に積み重なってしまいます。
3
3
  一行目の位置はそのままで、下方向に二行目以降が連なるようにしたいのですが、CSSではどう指定すればよろしいでしょうか?
4
4
  お分かりになる方、どなたか教えていただければ幸いです。

1

状況が再現できるHTMLとCSSを追記いたしました。

2018/02/23 07:03

投稿

riohik
riohik

スコア12

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,317 @@
1
1
  htmlページで文章が一定の長さを超えたとき、改行させたいのですが、
2
2
  改行すると、二行目が一行目があった位置に来てしまい、一行目だったものが上方向に積み重なってしまいます。
3
3
  一行目の位置はそのままで、下方向に二行目以降が連なるようにしたいのですが、CSSではどう指定すればよろしいでしょうか?
4
- お分かりになる方、どなたか教えていただければ幸いです。
4
+ お分かりになる方、どなたか教えていただければ幸いです。
5
+
6
+ ```html
7
+ <!DOCTYPE html>
8
+ <html>
9
+ <head>
10
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
11
+ <title></title>
12
+ <meta charset="utf-8">
13
+ <meta name="description" content="">
14
+ <meta name="author" content="">
15
+ <meta name="viewport" content="width=device-width, initial-scale=1">
16
+ <link rel="stylesheet" href="css/test.css">
17
+ </head>
18
+ <body id="group">
19
+ <section id="printoutput">
20
+ <div id="contents" class="contentsPage1">
21
+ <div id="headerCont">
22
+ <div id="titles">
23
+ <h1>
24
+ <span>強調される場所</span>見出しの文章
25
+ </h1>
26
+ <div class="names">
27
+ <p class="subtitles">サブタイトル</p>
28
+ <p class="group">ここにはグループ名が入ります。長いグループ名を入れると、グループ名が2行になることがあり、そちらが現在直面している問題です。どなたか教えていただければ幸いです。</p>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </section>
34
+ </body>
35
+ </html>
36
+ ```
37
+
38
+ ```css
39
+ @charset "UTF-8";
40
+
41
+ body {
42
+ -webkit-text-size-adjust: 100%;/* テキストサイズバグ回避 */
43
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
44
+ line-height: 1.6em;
45
+ font-family:sans-serif;
46
+ min-width: 320px;
47
+ font-size: 14px;
48
+ }
49
+ p,li,dd {
50
+ background: url("../t.gif");
51
+ max-height: 99999px;
52
+ }
53
+ dt,h2,h3,h4,h5 {max-height: 99999px;}
54
+ img {
55
+ vertical-align: bottom;
56
+ max-width: 100%;
57
+ }
58
+ a {
59
+ text-decoration: none;
60
+ color:inherit;
61
+ }
62
+ .sp_only {display: none;}
63
+ .print_only {display: none;}
64
+ @media (max-width: 500px) {
65
+ .pc_only {display: none;}
66
+ .sp_only {display: block;}
67
+ }
68
+
69
+ /*
70
+ box-sizing: border-box;
71
+ -webkit-box-sizing:border-box;
72
+ */
73
+
74
+ header {
75
+ width: 100%;
76
+ min-width: 500px;
77
+ margin: 0 auto;
78
+ text-align: center;
79
+ padding: 0 30px 0;
80
+ box-sizing:border-box;
81
+ position: fixed;
82
+ top: 0;
83
+ left: 0;
84
+ z-index: 999;
85
+ background: #ffffff;
86
+ /*overflow: hidden;*/
87
+ }
88
+
89
+ header #headerCont {
90
+ margin: 10px auto;
91
+ width: 1050px;
92
+ box-sizing: border-box;
93
+ padding: 0 25px;
94
+ }
95
+ header #titles {
96
+ width: 100%;
97
+ background: #2196F3;
98
+ box-sizing: border-box;
99
+ padding: 10px;
100
+
101
+ }
102
+ header #titles h1 {
103
+ color: #fff;
104
+ font-size: 200%;
105
+ height: 48px;
106
+ line-height: 48px;
107
+ text-align: left;
108
+ }
109
+ header #titles h1 span:first-child {
110
+ font-size: 130%;
111
+ letter-spacing: 0.1em;
112
+ }
113
+ header #titles > div {
114
+ overflow:hidden;
115
+ background: #E3F2FD;
116
+ padding: 8px;
117
+ }
118
+ header #titles > div > p {
119
+ float: left;
120
+ }
121
+ header #titles > div > .name {
122
+ float: right;
123
+ }
124
+
125
+ header #menuArea {
126
+ float: right;
127
+ position: relative;
128
+ padding-top: 30px;
129
+ }
130
+ header #menuArea .menuBtn {
131
+ position: absolute;
132
+ top: 0;
133
+ right: 0;
134
+ overflow:hidden;
135
+ z-index: 9999;
136
+ }
137
+ header #menuArea .menuBtn p {
138
+ cursor: pointer;
139
+ position: relative;
140
+ width: 40px;
141
+ height: 32px;
142
+ float: right;
143
+ z-index: 9999;
144
+ }
145
+ header #menuArea .menuBtn span {
146
+ background: #2196F3;
147
+ width: 40px;
148
+ height: 6px;
149
+ display: block;
150
+ position: absolute;
151
+ right: 0;
152
+ -webkit-transition: all .4s cubic-bezier(0.000, 0.605, 0.435, 1.000);
153
+ transition: all .4s cubic-bezier(0.000, 0.605, 0.435, 1.000);
154
+ z-index: 9999;
155
+ }
156
+
157
+ header #menuArea .menuBtn #bar1 { -webkit-transform: translateY(0); transform: translateY(0);}
158
+ header #menuArea .menuBtn #bar2 { -webkit-transform: translateY(13px); transform: translateY(13px);}
159
+ header #menuArea .menuBtn #bar3 { -webkit-transform: translateY(26px); transform: translateY(26px);}
160
+
161
+ header #menuArea .menuBtn.close #bar1 { -webkit-transform: translateY(13px) rotate(45deg); transform: translateY(13px) rotate(45deg);}
162
+ header #menuArea .menuBtn.close #bar2 { opacity: 0; /*-webkit-transform: translate(30px,13px); transform: translate(30px,13px);*/}
163
+ header #menuArea .menuBtn.close #bar3 { -webkit-transform: translateY(13px) rotate(-45deg); transform: translateY(13px) rotate(-45deg);}
164
+
165
+ header #menuArea .menuBtn h2 {
166
+ float: left;
167
+ margin-right: 0.5em;
168
+ font-size: 12px;
169
+ line-height: 12px;
170
+ color: #2196F3;
171
+ letter-spacing: 0.1em;
172
+ }
173
+
174
+
175
+
176
+ #menu {
177
+ display: none;
178
+ position: fixed;
179
+ top: 0;
180
+ left: 0;
181
+ width: 100%;
182
+ height: 100%;
183
+ box-sizing: border-box;
184
+ padding: 1em;
185
+ text-align: center;
186
+ background: rgba(255,255,255,0.9);
187
+ z-index: 999;
188
+ }
189
+
190
+
191
+
192
+ @media (max-width: 500px) {
193
+ header {
194
+ min-width: 320px;
195
+ padding: 1em 0 0;
196
+ /*position: relative;*/
197
+ }
198
+ header #titles {
199
+ width: 100%;
200
+ text-align: left;
201
+ overflow:hidden;
202
+ }
203
+ header #titles h1 {
204
+ font-size: 100%;
205
+ position: relative;
206
+ height: auto;
207
+ line-height: 1.5em;
208
+ padding: 0 0 10px;
209
+ }
210
+
211
+ header #titles h1 span + span {
212
+ display: none;
213
+ }
214
+ header #titles > div {
215
+ width: 100%;
216
+ box-sizing: border-box;
217
+ font-size: 92.8%;
218
+ padding: 5px 8px;
219
+ }
220
+ header #titles > div > p {
221
+ float: none;
222
+ }
223
+ header #titles > div > .name {
224
+ float: none;
225
+ }
226
+ /*header #titles .menuBtn {
227
+ width: 18%;
228
+ float: right;
229
+ }*/
230
+ header #menuArea .menuBtn {
231
+ right: 10px;
232
+ top: 10px;
233
+ }
234
+ header #menuArea img,
235
+ header #menuArea h2 {
236
+ display: none;
237
+ }
238
+ header #menuArea .menuBtn span {
239
+ background: #E3F2FD;
240
+ height: 4px;
241
+ width: 32px;
242
+ }
243
+ header #menuArea .menuBtn #bar2 { -webkit-transform: translateY(10px); transform: translateY(10px);}
244
+ header #menuArea .menuBtn #bar3 { -webkit-transform: translateY(20px); transform: translateY(20px);}
245
+
246
+ header #menuArea .menuBtn.close #bar1 { background: #2196F3;}
247
+ header #menuArea .menuBtn.close #bar3 { background: #2196F3;}
248
+ }
249
+ strong {
250
+ font-weight: bold;
251
+ }
252
+ @media (max-width: 500px) {
253
+ .w990 {
254
+ width: 100%;
255
+ box-sizing: border-box;
256
+ padding-left: 3%;
257
+ padding-right: 3%;
258
+ }
259
+ }
260
+
261
+ #contents {
262
+ width: 1050px;
263
+ margin: 0 auto 0;
264
+ overflow:hidden;
265
+ padding: 0 25px 100px;
266
+ box-sizing:border-box;
267
+ position: relative;
268
+ z-index: 1;
269
+ border-bottom: 1px dotted #ccc;
270
+ }
271
+
272
+ #contents #titles{
273
+ border-bottom: 5px solid #78909C;
274
+ /*margin-bottom: 10px;*/
275
+ margin-top: 30px;
276
+ margin-bottom: 100px;/*追加*/
277
+ height: 50px;
278
+ position: relative;
279
+ }
280
+ #contents #titles.title_comment{
281
+ margin-bottom: 30px;
282
+ margin-top: 10px;
283
+ }
284
+ #contents #titles.title_step{
285
+ margin-bottom: 80px;
286
+ margin-top: 10px;
287
+ }
288
+ #contents #titles h1{
289
+ position: absolute;
290
+ color: #78909C;
291
+ font-size: 140%;
292
+ left:0;
293
+ bottom: 4px;
294
+ }
295
+ #contents #titles h1 span{
296
+ font-size: 180%;
297
+ font-weight: bold;
298
+ margin-right: 10px;
299
+ }
300
+ #contents #titles .names{
301
+ position: absolute;
302
+ right:0;
303
+ bottom: 4px;
304
+ text-align: right;
305
+ }
306
+ #contents #titles .names .subtitles{
307
+ color: #78909C;
308
+ font-weight: bold;
309
+ margin-bottom: 15px;
310
+ font-size: 120%;
311
+ }
312
+ #contents #titles .names .group{
313
+ margin-bottom: -28px;
314
+ font-size: 95%;
315
+ line-height: 1.0em;
316
+ }
317
+ ```