質問編集履歴

1

htmlをすべて載せて、問題点を詳しく書き直しました

2016/05/29 17:09

投稿

sumomomo
sumomomo

スコア15

test CHANGED
File without changes
test CHANGED
@@ -26,11 +26,163 @@
26
26
 
27
27
 
28
28
 
29
+
30
+
31
+ ```css
32
+
33
+ /* 記事 */
34
+
35
+ div#odd, div#even {
36
+
37
+ border: solid 1px #C71585;
38
+
39
+ padding:15px;
40
+
41
+ margin-bottom: 20px;
42
+
43
+ background-color: #C71585;
44
+
45
+ color: #ffffff;
46
+
47
+ width: 515px;
48
+
49
+ float: left;
50
+
51
+ }
52
+
53
+
54
+
55
+ div#odd h2, div#even h2{
56
+
57
+ background-color: #C71585;
58
+
59
+ font-size:0.875em;
60
+
61
+ padding:10px;
62
+
63
+ margin: 0;
64
+
65
+ border: solid 1px #ffffff;
66
+
67
+ }
68
+
69
+ /* background-image: url(titlebar.png); タイトルバーに写真を入れる */
70
+
71
+ div#odd h2 a, div#even h2 a {
72
+
73
+ text-decoration: none;
74
+
75
+ color: #ffffff;
76
+
77
+ }
78
+
79
+
80
+
81
+ div#even p,div#odd p {
82
+
83
+ font-size: 0.875em;
84
+
85
+ line-height: 1.6;
86
+
87
+ margin-top: 10px;
88
+
89
+ }
90
+
91
+ p.postinfo {
92
+
93
+ color: #FFFFFF;
94
+
95
+ text-align:right;
96
+
97
+ margin: 20px 0 0;
98
+
99
+ clear: both;
100
+
101
+ }
102
+
103
+ p.postinfo a {
104
+
105
+ color: #FFFFFF;
106
+
107
+ }
108
+
109
+ p.postinfo a:hover {
110
+
111
+ color: #000000;
112
+
113
+ }
114
+
115
+ p.readmore {
116
+
117
+ color: #000000;
118
+
119
+ text-align: left;
120
+
121
+
122
+
123
+ }
124
+
125
+ ```
126
+
127
+
128
+
129
+
130
+
131
+ --------追記--------
132
+
133
+
134
+
135
+ >「うまくできない」とは「何をしたときに」「どうなると思って」「どうなったのか」
136
+
137
+
138
+
139
+ ・何をしたときに
140
+
141
+ 記事を二列に分けるために、is_odd_post()とis_even_post()を使って偶数番の記事と奇数番号の記事で分け、CSSでfloatなどで調整した
142
+
143
+
144
+
145
+ ・どうなると思って
146
+
147
+ 偶数記事 | 奇数記事
148
+
149
+ 偶数記事 | 奇数記事
150
+
151
+
152
+
153
+ と表示される
154
+
155
+
156
+
157
+ ・どうなったのか
158
+
159
+ 偶数記事 |
160
+
161
+ 偶数記事 | 奇数記事
162
+
163
+
164
+
165
+ と表示された
166
+
167
+
168
+
29
169
  ```html
30
170
 
171
+ <?php get_header(); ?>
172
+
173
+ <head>
174
+
175
+ <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/style.css"> <!-- CSS Stylesheet -->
176
+
177
+ </head>
178
+
179
+
180
+
181
+ <!-- コンテンツ -->
182
+
31
183
  <!-- odd number -->
32
184
 
33
- <?php if(have_posts()): while(have_posts()): the_post(); ?>
185
+ <?php if(have_posts()): while(have_posts()): the_post(); ?>
34
186
 
35
187
  <?php if (is_odd_post()): ?>
36
188
 
@@ -142,104 +294,32 @@
142
294
 
143
295
  <?php endwhile; endif; ?>
144
296
 
145
- <!-- end of even number -->
297
+ <!-- end of even number -->
298
+
299
+
300
+
301
+ <!--- End of コンテンツ --->
302
+
303
+
304
+
305
+ <!-- サイドバー -->
306
+
307
+ <div id="sidebar">
308
+
309
+ <ul>
310
+
311
+ <?php dynamic_sidebar(); ?>
312
+
313
+ </ul>
314
+
315
+ </div>
316
+
317
+
318
+
319
+ <?php get_footer(); ?>
320
+
321
+ </html>
322
+
323
+
146
324
 
147
325
  ```
148
-
149
-
150
-
151
- ```css
152
-
153
- /* 記事 */
154
-
155
- div#odd, div#even {
156
-
157
- border: solid 1px #C71585;
158
-
159
- padding:15px;
160
-
161
- margin-bottom: 20px;
162
-
163
- background-color: #C71585;
164
-
165
- color: #ffffff;
166
-
167
- width: 515px;
168
-
169
- float: left;
170
-
171
- }
172
-
173
-
174
-
175
- div#odd h2, div#even h2{
176
-
177
- background-color: #C71585;
178
-
179
- font-size:0.875em;
180
-
181
- padding:10px;
182
-
183
- margin: 0;
184
-
185
- border: solid 1px #ffffff;
186
-
187
- }
188
-
189
- /* background-image: url(titlebar.png); タイトルバーに写真を入れる */
190
-
191
- div#odd h2 a, div#even h2 a {
192
-
193
- text-decoration: none;
194
-
195
- color: #ffffff;
196
-
197
- }
198
-
199
-
200
-
201
- div#even p,div#odd p {
202
-
203
- font-size: 0.875em;
204
-
205
- line-height: 1.6;
206
-
207
- margin-top: 10px;
208
-
209
- }
210
-
211
- p.postinfo {
212
-
213
- color: #FFFFFF;
214
-
215
- text-align:right;
216
-
217
- margin: 20px 0 0;
218
-
219
- clear: both;
220
-
221
- }
222
-
223
- p.postinfo a {
224
-
225
- color: #FFFFFF;
226
-
227
- }
228
-
229
- p.postinfo a:hover {
230
-
231
- color: #000000;
232
-
233
- }
234
-
235
- p.readmore {
236
-
237
- color: #000000;
238
-
239
- text-align: left;
240
-
241
-
242
-
243
- }
244
-
245
- ```