質問編集履歴

3

test.cssと表記

2018/02/23 07:04

投稿

riohik
riohik

スコア12

test CHANGED
File without changes
test CHANGED
@@ -72,6 +72,8 @@
72
72
 
73
73
 
74
74
 
75
+ test.cssの内容です
76
+
75
77
  ```css
76
78
 
77
79
  @charset "UTF-8";

2

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

2018/02/23 07:04

投稿

riohik
riohik

スコア12

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- htmlページで文章が一定の長さを超えたとき、改行させたいのですが、
1
+ ![イメージ説明](830a22fcc0129482cf05445f38a37702.png)htmlページで文章が一定の長さを超えたとき、改行させたいのですが、
2
2
 
3
3
  改行すると、二行目が一行目があった位置に来てしまい、一行目だったものが上方向に積み重なってしまいます。
4
4
 

1

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

2018/02/23 07:03

投稿

riohik
riohik

スコア12

test CHANGED
File without changes
test CHANGED
@@ -5,3 +5,629 @@
5
5
  一行目の位置はそのままで、下方向に二行目以降が連なるようにしたいのですが、CSSではどう指定すればよろしいでしょうか?
6
6
 
7
7
  お分かりになる方、どなたか教えていただければ幸いです。
8
+
9
+
10
+
11
+ ```html
12
+
13
+ <!DOCTYPE html>
14
+
15
+ <html>
16
+
17
+ <head>
18
+
19
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
20
+
21
+ <title></title>
22
+
23
+ <meta charset="utf-8">
24
+
25
+ <meta name="description" content="">
26
+
27
+ <meta name="author" content="">
28
+
29
+ <meta name="viewport" content="width=device-width, initial-scale=1">
30
+
31
+ <link rel="stylesheet" href="css/test.css">
32
+
33
+ </head>
34
+
35
+ <body id="group">
36
+
37
+ <section id="printoutput">
38
+
39
+ <div id="contents" class="contentsPage1">
40
+
41
+ <div id="headerCont">
42
+
43
+ <div id="titles">
44
+
45
+ <h1>
46
+
47
+ <span>強調される場所</span>見出しの文章
48
+
49
+ </h1>
50
+
51
+ <div class="names">
52
+
53
+ <p class="subtitles">サブタイトル</p>
54
+
55
+ <p class="group">ここにはグループ名が入ります。長いグループ名を入れると、グループ名が2行になることがあり、そちらが現在直面している問題です。どなたか教えていただければ幸いです。</p>
56
+
57
+ </div>
58
+
59
+ </div>
60
+
61
+ </div>
62
+
63
+ </div>
64
+
65
+ </section>
66
+
67
+ </body>
68
+
69
+ </html>
70
+
71
+ ```
72
+
73
+
74
+
75
+ ```css
76
+
77
+ @charset "UTF-8";
78
+
79
+
80
+
81
+ body {
82
+
83
+ -webkit-text-size-adjust: 100%;/* テキストサイズバグ回避 */
84
+
85
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
86
+
87
+ line-height: 1.6em;
88
+
89
+ font-family:sans-serif;
90
+
91
+ min-width: 320px;
92
+
93
+ font-size: 14px;
94
+
95
+ }
96
+
97
+ p,li,dd {
98
+
99
+ background: url("../t.gif");
100
+
101
+ max-height: 99999px;
102
+
103
+ }
104
+
105
+ dt,h2,h3,h4,h5 {max-height: 99999px;}
106
+
107
+ img {
108
+
109
+ vertical-align: bottom;
110
+
111
+ max-width: 100%;
112
+
113
+ }
114
+
115
+ a {
116
+
117
+ text-decoration: none;
118
+
119
+ color:inherit;
120
+
121
+ }
122
+
123
+ .sp_only {display: none;}
124
+
125
+ .print_only {display: none;}
126
+
127
+ @media (max-width: 500px) {
128
+
129
+ .pc_only {display: none;}
130
+
131
+ .sp_only {display: block;}
132
+
133
+ }
134
+
135
+
136
+
137
+ /*
138
+
139
+ box-sizing: border-box;
140
+
141
+ -webkit-box-sizing:border-box;
142
+
143
+ */
144
+
145
+
146
+
147
+ header {
148
+
149
+ width: 100%;
150
+
151
+ min-width: 500px;
152
+
153
+ margin: 0 auto;
154
+
155
+ text-align: center;
156
+
157
+ padding: 0 30px 0;
158
+
159
+ box-sizing:border-box;
160
+
161
+ position: fixed;
162
+
163
+ top: 0;
164
+
165
+ left: 0;
166
+
167
+ z-index: 999;
168
+
169
+ background: #ffffff;
170
+
171
+ /*overflow: hidden;*/
172
+
173
+ }
174
+
175
+
176
+
177
+ header #headerCont {
178
+
179
+ margin: 10px auto;
180
+
181
+ width: 1050px;
182
+
183
+ box-sizing: border-box;
184
+
185
+ padding: 0 25px;
186
+
187
+ }
188
+
189
+ header #titles {
190
+
191
+ width: 100%;
192
+
193
+ background: #2196F3;
194
+
195
+ box-sizing: border-box;
196
+
197
+ padding: 10px;
198
+
199
+
200
+
201
+ }
202
+
203
+ header #titles h1 {
204
+
205
+ color: #fff;
206
+
207
+ font-size: 200%;
208
+
209
+ height: 48px;
210
+
211
+ line-height: 48px;
212
+
213
+ text-align: left;
214
+
215
+ }
216
+
217
+ header #titles h1 span:first-child {
218
+
219
+ font-size: 130%;
220
+
221
+ letter-spacing: 0.1em;
222
+
223
+ }
224
+
225
+ header #titles > div {
226
+
227
+ overflow:hidden;
228
+
229
+ background: #E3F2FD;
230
+
231
+ padding: 8px;
232
+
233
+ }
234
+
235
+ header #titles > div > p {
236
+
237
+ float: left;
238
+
239
+ }
240
+
241
+ header #titles > div > .name {
242
+
243
+ float: right;
244
+
245
+ }
246
+
247
+
248
+
249
+ header #menuArea {
250
+
251
+ float: right;
252
+
253
+ position: relative;
254
+
255
+ padding-top: 30px;
256
+
257
+ }
258
+
259
+ header #menuArea .menuBtn {
260
+
261
+ position: absolute;
262
+
263
+ top: 0;
264
+
265
+ right: 0;
266
+
267
+ overflow:hidden;
268
+
269
+ z-index: 9999;
270
+
271
+ }
272
+
273
+ header #menuArea .menuBtn p {
274
+
275
+ cursor: pointer;
276
+
277
+ position: relative;
278
+
279
+ width: 40px;
280
+
281
+ height: 32px;
282
+
283
+ float: right;
284
+
285
+ z-index: 9999;
286
+
287
+ }
288
+
289
+ header #menuArea .menuBtn span {
290
+
291
+ background: #2196F3;
292
+
293
+ width: 40px;
294
+
295
+ height: 6px;
296
+
297
+ display: block;
298
+
299
+ position: absolute;
300
+
301
+ right: 0;
302
+
303
+ -webkit-transition: all .4s cubic-bezier(0.000, 0.605, 0.435, 1.000);
304
+
305
+ transition: all .4s cubic-bezier(0.000, 0.605, 0.435, 1.000);
306
+
307
+ z-index: 9999;
308
+
309
+ }
310
+
311
+
312
+
313
+ header #menuArea .menuBtn #bar1 { -webkit-transform: translateY(0); transform: translateY(0);}
314
+
315
+ header #menuArea .menuBtn #bar2 { -webkit-transform: translateY(13px); transform: translateY(13px);}
316
+
317
+ header #menuArea .menuBtn #bar3 { -webkit-transform: translateY(26px); transform: translateY(26px);}
318
+
319
+
320
+
321
+ header #menuArea .menuBtn.close #bar1 { -webkit-transform: translateY(13px) rotate(45deg); transform: translateY(13px) rotate(45deg);}
322
+
323
+ header #menuArea .menuBtn.close #bar2 { opacity: 0; /*-webkit-transform: translate(30px,13px); transform: translate(30px,13px);*/}
324
+
325
+ header #menuArea .menuBtn.close #bar3 { -webkit-transform: translateY(13px) rotate(-45deg); transform: translateY(13px) rotate(-45deg);}
326
+
327
+
328
+
329
+ header #menuArea .menuBtn h2 {
330
+
331
+ float: left;
332
+
333
+ margin-right: 0.5em;
334
+
335
+ font-size: 12px;
336
+
337
+ line-height: 12px;
338
+
339
+ color: #2196F3;
340
+
341
+ letter-spacing: 0.1em;
342
+
343
+ }
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+ #menu {
352
+
353
+ display: none;
354
+
355
+ position: fixed;
356
+
357
+ top: 0;
358
+
359
+ left: 0;
360
+
361
+ width: 100%;
362
+
363
+ height: 100%;
364
+
365
+ box-sizing: border-box;
366
+
367
+ padding: 1em;
368
+
369
+ text-align: center;
370
+
371
+ background: rgba(255,255,255,0.9);
372
+
373
+ z-index: 999;
374
+
375
+ }
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+ @media (max-width: 500px) {
384
+
385
+ header {
386
+
387
+ min-width: 320px;
388
+
389
+ padding: 1em 0 0;
390
+
391
+ /*position: relative;*/
392
+
393
+ }
394
+
395
+ header #titles {
396
+
397
+ width: 100%;
398
+
399
+ text-align: left;
400
+
401
+ overflow:hidden;
402
+
403
+ }
404
+
405
+ header #titles h1 {
406
+
407
+ font-size: 100%;
408
+
409
+ position: relative;
410
+
411
+ height: auto;
412
+
413
+ line-height: 1.5em;
414
+
415
+ padding: 0 0 10px;
416
+
417
+ }
418
+
419
+
420
+
421
+ header #titles h1 span + span {
422
+
423
+ display: none;
424
+
425
+ }
426
+
427
+ header #titles > div {
428
+
429
+ width: 100%;
430
+
431
+ box-sizing: border-box;
432
+
433
+ font-size: 92.8%;
434
+
435
+ padding: 5px 8px;
436
+
437
+ }
438
+
439
+ header #titles > div > p {
440
+
441
+ float: none;
442
+
443
+ }
444
+
445
+ header #titles > div > .name {
446
+
447
+ float: none;
448
+
449
+ }
450
+
451
+ /*header #titles .menuBtn {
452
+
453
+ width: 18%;
454
+
455
+ float: right;
456
+
457
+ }*/
458
+
459
+ header #menuArea .menuBtn {
460
+
461
+ right: 10px;
462
+
463
+ top: 10px;
464
+
465
+ }
466
+
467
+ header #menuArea img,
468
+
469
+ header #menuArea h2 {
470
+
471
+ display: none;
472
+
473
+ }
474
+
475
+ header #menuArea .menuBtn span {
476
+
477
+ background: #E3F2FD;
478
+
479
+ height: 4px;
480
+
481
+ width: 32px;
482
+
483
+ }
484
+
485
+ header #menuArea .menuBtn #bar2 { -webkit-transform: translateY(10px); transform: translateY(10px);}
486
+
487
+ header #menuArea .menuBtn #bar3 { -webkit-transform: translateY(20px); transform: translateY(20px);}
488
+
489
+
490
+
491
+ header #menuArea .menuBtn.close #bar1 { background: #2196F3;}
492
+
493
+ header #menuArea .menuBtn.close #bar3 { background: #2196F3;}
494
+
495
+ }
496
+
497
+ strong {
498
+
499
+ font-weight: bold;
500
+
501
+ }
502
+
503
+ @media (max-width: 500px) {
504
+
505
+ .w990 {
506
+
507
+ width: 100%;
508
+
509
+ box-sizing: border-box;
510
+
511
+ padding-left: 3%;
512
+
513
+ padding-right: 3%;
514
+
515
+ }
516
+
517
+ }
518
+
519
+
520
+
521
+ #contents {
522
+
523
+ width: 1050px;
524
+
525
+ margin: 0 auto 0;
526
+
527
+ overflow:hidden;
528
+
529
+ padding: 0 25px 100px;
530
+
531
+ box-sizing:border-box;
532
+
533
+ position: relative;
534
+
535
+ z-index: 1;
536
+
537
+ border-bottom: 1px dotted #ccc;
538
+
539
+ }
540
+
541
+
542
+
543
+ #contents #titles{
544
+
545
+ border-bottom: 5px solid #78909C;
546
+
547
+ /*margin-bottom: 10px;*/
548
+
549
+ margin-top: 30px;
550
+
551
+ margin-bottom: 100px;/*追加*/
552
+
553
+ height: 50px;
554
+
555
+ position: relative;
556
+
557
+ }
558
+
559
+ #contents #titles.title_comment{
560
+
561
+ margin-bottom: 30px;
562
+
563
+ margin-top: 10px;
564
+
565
+ }
566
+
567
+ #contents #titles.title_step{
568
+
569
+ margin-bottom: 80px;
570
+
571
+ margin-top: 10px;
572
+
573
+ }
574
+
575
+ #contents #titles h1{
576
+
577
+ position: absolute;
578
+
579
+ color: #78909C;
580
+
581
+ font-size: 140%;
582
+
583
+ left:0;
584
+
585
+ bottom: 4px;
586
+
587
+ }
588
+
589
+ #contents #titles h1 span{
590
+
591
+ font-size: 180%;
592
+
593
+ font-weight: bold;
594
+
595
+ margin-right: 10px;
596
+
597
+ }
598
+
599
+ #contents #titles .names{
600
+
601
+ position: absolute;
602
+
603
+ right:0;
604
+
605
+ bottom: 4px;
606
+
607
+ text-align: right;
608
+
609
+ }
610
+
611
+ #contents #titles .names .subtitles{
612
+
613
+ color: #78909C;
614
+
615
+ font-weight: bold;
616
+
617
+ margin-bottom: 15px;
618
+
619
+ font-size: 120%;
620
+
621
+ }
622
+
623
+ #contents #titles .names .group{
624
+
625
+ margin-bottom: -28px;
626
+
627
+ font-size: 95%;
628
+
629
+ line-height: 1.0em;
630
+
631
+ }
632
+
633
+ ```