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

回答編集履歴

3

追記

2017/02/09 10:11

投稿

s8_chu
s8_chu

スコア14731

answer CHANGED
@@ -11,286 +11,325 @@
11
11
  <meta charset="utf-8">
12
12
  <title>Home</title>
13
13
  <style type="text/css">
14
- /* @import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700); */
14
+ /* 文字数制限の関係で省略させていただきます。内容は追記のCSSと変わりませんので、そちらを参考にしてください。 */
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <table>
19
+ <tr class="line">
20
+ <th>aaaa</th>
21
+ <th>aaaa</th>
22
+ <th>aaaa</th>
23
+ </tr>
24
+ <tr bgcolor="wheat">
25
+ <td>aaaaa</td>
26
+ <td>aaaaa</td>
27
+ <td>aaaaa</td>
28
+ </tr>
29
+ <tr bgcolor="lightyellow">
30
+ <td>aaaaaaaa</td>
31
+ <td>aaaaaaa</td>
32
+ <td>aaaaaaa</td>
33
+ </tr>
34
+ </table>
35
+ </body>
36
+ </html>
37
+ ```
15
38
 
39
+ ---
40
+ **(追記)**
41
+ HTML部分:
42
+ ```HTML
43
+ <!DOCTYPE html>
44
+ <html>
45
+ <head>
46
+ <meta charset="utf-8">
47
+ <title>Home</title>
48
+ <link rel="stylesheet"
49
+ href="${pageContext.request.contextPath}/resources/app/css/styles.css">
50
+ </head>
16
- body {
51
+ <body>
17
- padding: 50px;
18
- font: 14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
19
- color: #777;
52
+ <table>
53
+ <tr class="line">
54
+ <th>aaaa</th>
55
+ <th>aaaa</th>
56
+ <th>aaaa</th>
57
+ </tr>
58
+ <tr bgcolor="wheat">
59
+ <td>aaaaa</td>
60
+ <td>aaaaa</td>
61
+ <td>aaaaa</td>
62
+ </tr>
63
+ <tr bgcolor="lightyellow">
64
+ <td>aaaaaaaa</td>
65
+ <td>aaaaaaa</td>
66
+ <td>aaaaaaa</td>
67
+ </tr>
68
+ </table>
69
+ </body>
20
- font-weight: 300;
70
+ </html>
21
- }
71
+ ```
22
72
 
23
- h1, h2, h3, h4, h5, h6 {
24
- color: #222;
73
+ CSS部分:
25
- margin: 0 0 20px;
74
+ ```CSS
26
- }
75
+ /* @import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700); */
27
76
 
28
- p, ul, ol, table, pre, dl {
77
+ body {
29
- margin: 0 0 20px;
78
+ padding: 50px;
79
+ font: 14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
80
+ color: #777;
81
+ font-weight: 300;
30
- }
82
+ }
31
83
 
32
- h1, h2, h3 {
84
+ h1, h2, h3, h4, h5, h6 {
85
+ color: #222;
33
- line-height: 1.1;
86
+ margin: 0 0 20px;
34
- }
87
+ }
35
88
 
36
- h1 {
89
+ p, ul, ol, table, pre, dl {
37
- font-size: 28px;
90
+ margin: 0 0 20px;
38
- }
91
+ }
39
92
 
40
- h2 {
41
- color: #393939;
93
+ h1, h2, h3 {
94
+ line-height: 1.1;
42
- }
95
+ }
43
96
 
44
- h3, h4, h5, h6 {
97
+ h1 {
45
- color: #494949;
98
+ font-size: 28px;
46
- }
99
+ }
47
100
 
48
- a {
101
+ h2 {
49
- color: #39c;
102
+ color: #393939;
50
- font-weight: 400;
51
- text-decoration: none;
52
- }
103
+ }
53
104
 
54
- a small {
55
- font-size: 11px;
105
+ h3, h4, h5, h6 {
56
- color: #777;
106
+ color: #494949;
57
- margin-top: -0.6em;
58
- display: block;
59
- }
107
+ }
60
108
 
61
- .wrapper {
109
+ a {
62
- width: 860px;
110
+ color: #39c;
63
- margin: 0 auto;
111
+ font-weight: 400;
112
+ text-decoration: none;
64
- }
113
+ }
65
114
 
66
- blockquote {
67
- border-left: 1px solid #e5e5e5;
68
- margin: 0;
115
+ a small {
69
- padding: 0 0 0 20px;
70
- font-style: italic;
116
+ font-size: 11px;
117
+ color: #777;
118
+ margin-top: -0.6em;
119
+ display: block;
71
- }
120
+ }
72
121
 
73
- code, pre {
122
+ .wrapper {
74
- font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal;
75
- color: #333;
76
- font-size: 12px;
123
+ width: 860px;
124
+ margin: 0 auto;
77
- }
125
+ }
78
126
 
79
- pre {
80
- padding: 8px 15px;
81
- background: #f8f8f8;
127
+ blockquote {
82
- border-radius: 5px;
83
- border: 1px solid #e5e5e5;
128
+ border-left: 1px solid #e5e5e5;
129
+ margin: 0;
130
+ padding: 0 0 0 20px;
84
- overflow-x: auto;
131
+ font-style: italic;
85
- }
132
+ }
86
133
 
87
- table {
134
+ code, pre {
135
+ font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal;
88
- width: 100%;
136
+ color: #333;
89
- border-collapse: collapse;
137
+ font-size: 12px;
90
- }
138
+ }
91
139
 
92
- th, td {
140
+ pre {
93
- text-align: left;
94
- padding: 5px 10px;
141
+ padding: 8px 15px;
142
+ background: #f8f8f8;
143
+ border-radius: 5px;
95
- border-bottom: 1px solid #e5e5e5;
144
+ border: 1px solid #e5e5e5;
145
+ overflow-x: auto;
96
- }
146
+ }
97
147
 
98
- dt {
148
+ table {
99
- color: #444;
149
+ width: 100%;
100
- font-weight: 700;
150
+ border-collapse: collapse;
101
- }
151
+ }
102
152
 
103
- th {
153
+ th, td {
104
- color: #444;
154
+ text-align: left;
155
+ padding: 5px 10px;
156
+ border-bottom: 1px solid #e5e5e5;
105
- }
157
+ }
106
158
 
107
- img {
159
+ dt {
160
+ color: #444;
108
- max-width: 100%;
161
+ font-weight: 700;
109
- }
162
+ }
110
163
 
111
- header {
164
+ th {
112
- width: 270px;
113
- float: left;
165
+ color: #444;
114
- position: fixed;
115
- }
166
+ }
116
167
 
117
- header ul {
168
+ img {
118
- list-style: none;
119
- height: 40px;
169
+ max-width: 100%;
170
+ }
120
171
 
172
+ header {
173
+ width: 270px;
174
+ float: left;
121
- padding: 0;
175
+ position: fixed;
176
+ }
122
177
 
178
+ header ul {
123
- background: #eee;
179
+ list-style: none;
124
- background: -moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
125
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f8f8f8), color-stop(100%, #dddddd));
126
- background: -webkit-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
127
- background: -o-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
128
- background: -ms-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
129
- background: linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
180
+ height: 40px;
130
181
 
131
- border-radius: 5px;
132
- border: 1px solid #d2d2d2;
133
- box-shadow: inset #fff 0 1px 0, inset rgba(0, 0, 0, 0.03) 0 -1px 0;
134
- width: 270px;
182
+ padding: 0;
135
- }
136
183
 
137
- header li {
138
- width: 89px;
139
- float: left;
184
+ background: #eee;
185
+ background: -moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
186
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f8f8f8), color-stop(100%, #dddddd));
187
+ background: -webkit-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
188
+ background: -o-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
189
+ background: -ms-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
140
- border-right: 1px solid #d2d2d2;
190
+ background: linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
141
- height: 40px;
142
- }
143
191
 
144
- header ul a {
145
- line-height: 1;
146
- font-size: 11px;
192
+ border-radius: 5px;
147
- color: #999;
148
- display: block;
149
- text-align: center;
193
+ border: 1px solid #d2d2d2;
150
- padding-top: 6px;
194
+ box-shadow: inset #fff 0 1px 0, inset rgba(0, 0, 0, 0.03) 0 -1px 0;
151
- height: 40px;
195
+ width: 270px;
152
- }
196
+ }
153
197
 
154
- strong {
198
+ header li {
199
+ width: 89px;
155
- color: #222;
200
+ float: left;
201
+ border-right: 1px solid #d2d2d2;
156
- font-weight: 700;
202
+ height: 40px;
157
- }
203
+ }
158
204
 
159
- header ul li + li {
205
+ header ul a {
206
+ line-height: 1;
207
+ font-size: 11px;
208
+ color: #999;
209
+ display: block;
210
+ text-align: center;
211
+ padding-top: 6px;
160
- width: 88px;
212
+ height: 40px;
161
- border-left: 1px solid #fff;
162
- }
213
+ }
163
214
 
215
+ strong {
164
- header ul li + li + li {
216
+ color: #222;
165
- border-right: none;
217
+ font-weight: 700;
166
- width: 89px;
167
- }
218
+ }
168
219
 
169
- header ul a strong {
220
+ header ul li + li {
170
- font-size: 14px;
221
+ width: 88px;
171
- display: block;
222
+ border-left: 1px solid #fff;
172
- color: #222;
173
- }
223
+ }
174
224
 
225
+ header ul li + li + li {
175
- section {
226
+ border-right: none;
176
- width: 500px;
227
+ width: 89px;
177
- float: right;
178
- padding-bottom: 50px;
179
- }
228
+ }
180
229
 
181
- small {
230
+ header ul a strong {
182
- font-size: 11px;
231
+ font-size: 14px;
232
+ display: block;
233
+ color: #222;
183
- }
234
+ }
184
235
 
185
- hr {
186
- border: 0;
236
+ section {
187
- background: #e5e5e5;
188
- height: 1px;
237
+ width: 500px;
238
+ float: right;
189
- margin: 0 0 20px;
239
+ padding-bottom: 50px;
190
- }
240
+ }
191
241
 
192
- footer {
242
+ small {
193
- width: 270px;
194
- float: left;
195
- position: fixed;
196
- bottom: 50px;
243
+ font-size: 11px;
197
- }
244
+ }
198
245
 
246
+ hr {
247
+ border: 0;
248
+ background: #e5e5e5;
249
+ height: 1px;
199
- @media print, screen and (max-width: 960px) {
250
+ margin: 0 0 20px;
251
+ }
200
252
 
201
- div.wrapper {
253
+ footer {
202
- width: auto;
254
+ width: 270px;
255
+ float: left;
256
+ position: fixed;
203
- margin: 0;
257
+ bottom: 50px;
204
- }
258
+ }
205
259
 
206
- header, section, footer {
260
+ @media print, screen and (max-width: 960px) {
207
- float: none;
208
- position: static;
209
- width: auto;
210
- }
211
261
 
212
- header {
262
+ div.wrapper {
263
+ width: auto;
213
- padding-right: 320px;
264
+ margin: 0;
214
- }
265
+ }
215
266
 
216
- section {
217
- border: 1px solid #e5e5e5;
267
+ header, section, footer {
218
- border-width: 1px 0;
268
+ float: none;
219
- padding: 20px 0;
269
+ position: static;
220
- margin: 0 0 20px;
270
+ width: auto;
221
- }
271
+ }
222
272
 
223
- header a small {
273
+ header {
224
- display: inline;
274
+ padding-right: 320px;
225
- }
275
+ }
226
276
 
227
- header ul {
277
+ section {
278
+ border: 1px solid #e5e5e5;
279
+ border-width: 1px 0;
228
- position: absolute;
280
+ padding: 20px 0;
229
- right: 50px;
281
+ margin: 0 0 20px;
230
- top: 52px;
231
- }
282
+ }
232
- }
233
283
 
234
- @media print, screen and (max-width: 720px) {
235
- body {
236
- word-wrap: break-word;
284
+ header a small {
285
+ display: inline;
237
- }
286
+ }
238
287
 
239
- header {
288
+ header ul {
289
+ position: absolute;
240
- padding: 0;
290
+ right: 50px;
291
+ top: 52px;
241
- }
292
+ }
293
+ }
242
294
 
243
- header ul, header p.view {
295
+ @media print, screen and (max-width: 720px) {
296
+ body {
244
- position: static;
297
+ word-wrap: break-word;
245
- }
298
+ }
246
299
 
247
- pre, code {
300
+ header {
248
- word-wrap: normal;
301
+ padding: 0;
249
- }
302
+ }
250
- }
251
303
 
252
- @media print, screen and (max-width: 480px) {
304
+ header ul, header p.view {
253
- body {
254
- padding: 15px;
305
+ position: static;
255
- }
306
+ }
256
307
 
257
- header ul {
308
+ pre, code {
258
- display: none;
309
+ word-wrap: normal;
259
- }
310
+ }
260
- }
311
+ }
261
312
 
262
- @media print {
313
+ @media print, screen and (max-width: 480px) {
263
- body {
314
+ body {
264
- padding: 0.4in;
315
+ padding: 15px;
265
- font-size: 12pt;
266
- color: #444;
267
- }
316
+ }
268
- }
269
317
 
318
+ header ul {
319
+ display: none;
320
+ }
321
+ }
322
+
323
+ @media print {
324
+ body {
325
+ padding: 0.4in;
326
+ font-size: 12pt;
327
+ color: #444;
328
+ }
329
+ }
330
+
270
- .line {
331
+ .line {
271
- background-color: gold; /* bgcolorではなくbackground-color */
332
+ background-color: gold; /* bgcolorではなくbackground-color */
272
- color: White;
333
+ color: White;
273
- }
334
+ }
274
- </style>
275
- </head>
276
- <body>
277
- <table>
278
- <tr class="line">
279
- <th>aaaa</th>
280
- <th>aaaa</th>
281
- <th>aaaa</th>
282
- </tr>
283
- <tr bgcolor="wheat">
284
- <td>aaaaa</td>
285
- <td>aaaaa</td>
286
- <td>aaaaa</td>
287
- </tr>
288
- <tr bgcolor="lightyellow">
289
- <td>aaaaaaaa</td>
290
- <td>aaaaaaa</td>
291
- <td>aaaaaaa</td>
292
- </tr>
293
- </table>
294
- </body>
295
- </html>
296
335
  ```

2

修正

2017/02/09 10:11

投稿

s8_chu
s8_chu

スコア14731

answer CHANGED
@@ -2,7 +2,8 @@
2
2
  また、[tableタグ直下にdivタグを記述することはできません。](https://www.w3.org/TR/html51/tabular-data.html#the-table-element)
3
3
  > Content model:
4
4
  > In this order: optionally a caption element, followed by zero or more colgroup elements, followed optionally by a thead element, followed by either zero or more tbody elements or one or more tr elements, followed optionally by a tfoot element, optionally intermixed with one or more script-supporting elements.
5
+
5
- これを踏まえると、質問者さんのコードは以下のように書けると思います。
6
+ これを踏まえると、質問者さんのコードは以下のように書けると思います。
6
7
  ```HTML
7
8
  <!DOCTYPE html>
8
9
  <html>

1

追記

2017/02/09 08:42

投稿

s8_chu
s8_chu

スコア14731

answer CHANGED
@@ -1,5 +1,5 @@
1
1
  lineクラスに指定してあるbgcolorプロパティは[background-colorプロパティ](http://www.htmq.com/style/background-color.shtml)の誤りでは?必ずしもHTMLの属性名がCSSのプロパティ名と同じではないことに注意してください。
2
- [tableタグ直下にdivタグを記述することはできません。](https://www.w3.org/TR/html51/tabular-data.html#the-table-element)
2
+ また、[tableタグ直下にdivタグを記述することはできません。](https://www.w3.org/TR/html51/tabular-data.html#the-table-element)
3
3
  > Content model:
4
4
  > In this order: optionally a caption element, followed by zero or more colgroup elements, followed optionally by a thead element, followed by either zero or more tbody elements or one or more tr elements, followed optionally by a tfoot element, optionally intermixed with one or more script-supporting elements.
5
5
  これを踏まえると、質問者さんのコードは以下のように書けると思います。