|
12 | 12 | orphans: 3; |
13 | 13 | gap: 1em; |
14 | 14 | column-rule: 2px dashed #666; |
| 15 | + height: 40em; |
15 | 16 | } |
16 | 17 | .title { |
17 | 18 | column-span: all; |
|
24 | 25 | margin: 0 0 1em 0; |
25 | 26 | line-height: 1.4; |
26 | 27 | } |
| 28 | + .breakInside p { |
| 29 | + break-inside: avoid; |
| 30 | + } |
27 | 31 | #options { |
28 | 32 | position: fixed; |
29 | 33 | top: 1rem; |
30 | 34 | right: 1rem; |
31 | 35 | background: white; |
32 | 36 | display: none; |
33 | 37 | } |
| 38 | + fieldset p { |
| 39 | + margin-bottom: 0.25em; |
| 40 | + } |
34 | 41 | [aria-expanded] { |
35 | 42 | position: relative; |
36 | 43 | top: 0; |
|
52 | 59 | } |
53 | 60 | blockquote { |
54 | 61 | border: 2px dashed red; |
55 | | - margin: 0; |
| 62 | + margin: 0 0 0.25em 0; |
56 | 63 | } |
57 | 64 | blockquote p { |
58 | 65 | margin-bottom: 0; |
@@ -186,64 +193,15 @@ <h1>A Lament for Confederation</h1> |
186 | 193 | <input type="checkbox" id="blockSpan" /> |
187 | 194 | <label for="blockSpan">Blockquote spans all columns</label> |
188 | 195 | </p> |
| 196 | + <p> |
| 197 | + <input type="checkbox" id="colFill" /> |
| 198 | + <label for="colFill">Balance columns</label> |
| 199 | + </p> |
| 200 | + <p> |
| 201 | + <input type="checkbox" id="break" /> |
| 202 | + <label for="break">Don't break paragraphs</label> |
| 203 | + </p> |
189 | 204 | </div> |
190 | 205 | </fieldset> |
191 | | - <script> |
192 | | - const article = document.querySelector("article"); |
193 | | - const title = document.querySelector(".title"); |
194 | | - const options = document.querySelector("#options"); |
195 | | - const legend = document.querySelector("#options > legend"); |
196 | | - const colCount = document.getElementById("colCount"); |
197 | | - const colWidth = document.getElementById("colWidth"); |
198 | | - const gapSize = document.getElementById("gapSize"); |
199 | | - const colSpan = document.getElementById("colSpan"); |
200 | | - const blockSpan = document.getElementById("blockSpan"); |
201 | | - const blockquote = document.getElementsByTagName("blockquote")[0]; |
202 | | - |
203 | | - // make options visible if js is enabled |
204 | | - options.style.display = "revert"; |
205 | | - |
206 | | - legend.addEventListener("click", () => { |
207 | | - showAndHideMenu(); |
208 | | - }); |
209 | | - |
210 | | - colCount.addEventListener("change", () => { |
211 | | - article.style.columnCount = colCount.value; |
212 | | - }); |
213 | | - |
214 | | - colWidth.addEventListener("change", () => { |
215 | | - article.style.columnWidth = `${colWidth.value}em`; |
216 | | - }); |
217 | | - |
218 | | - gapSize.addEventListener("change", () => { |
219 | | - article.style.gap = `${gapSize.value}em`; |
220 | | - }); |
221 | | - |
222 | | - colSpan.addEventListener("change", () => { |
223 | | - if (colSpan.checked) { |
224 | | - title.style.columnSpan = "all"; |
225 | | - } else { |
226 | | - title.style.columnSpan = "none"; |
227 | | - } |
228 | | - }); |
229 | | - |
230 | | - blockSpan.addEventListener("change", () => { |
231 | | - if (blockSpan.checked) { |
232 | | - blockquote.style.columnSpan = "all"; |
233 | | - } else { |
234 | | - blockquote.style.columnSpan = "none"; |
235 | | - } |
236 | | - }); |
237 | | - |
238 | | - function showAndHideMenu() { |
239 | | - if (legend.getAttribute("aria-expanded") === "true") { |
240 | | - // close it |
241 | | - legend.setAttribute("aria-expanded", "false"); |
242 | | - } else { |
243 | | - // open it |
244 | | - legend.setAttribute("aria-expanded", "true"); |
245 | | - } |
246 | | - } |
247 | | - </script> |
248 | 206 | </body> |
249 | 207 | </html> |
0 commit comments