X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=style.css;h=65b0b17b7ac58801e9b611ce2fa9c6bcd4fd3bfb;hp=899b902b78e680d7ef91df985951b23cd9bc4969;hb=d63fff6b0b7142e9592f627a53d86f457d675ff2;hpb=97f1fd386a064f94c46ea0e959d680ade224d40d diff --git a/style.css b/style.css index 899b902..65b0b17 100644 --- a/style.css +++ b/style.css @@ -18,3 +18,58 @@ h2 { font-size: 110%; font-weight: bold; } + +/*\ +|*| +|*| Responsive form layout +|*| +\*/ + +/* + * + * Within the form, fields can be placed in
elements with + * class "form-field". Each can also have an additional class of one + * of "small", "medium", or "large". These classes will be used to + * select either a 1- or 2-column layout for each row depending on the + * width of the screen. + * + * Expected layout is as follows: + * + * "large" rows: 1-column on all devices + * + * "medium" rows: 2-column on wide displays (laptop/desktop/tablet) + * 1-column on small display (phones) + * + * "small" rows: 2-column on all devices + * + * Finally, a class of either "left" or "right" will select which + * column the field should appear in for fields that end up in 2 + * columns. + */ +form { + max-width: 100%; + display: grid; + grid-template-columns: 49% 49%; + grid-column-gap: 2%; +} + +.form-field.small.left,.form-field.medium.left { + grid-column-start: 1; +} + +.form-field.small.right,.form-field.medium.right { + grid-column-start: 2; +} + +.form-field.large { + grid-column-start: 1; + grid-column-end: span 2; +} + +/* For a narrow screen, use a single-column for medium form fields. */ +@media screen and (max-width: 600px) { + .form-field.medium.left,.form-field.medium.right { + grid-column-start: 1; + grid-column-end: span 2 + } +}