|
| 1 | +> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | +<title>Working example - Using min-height and min-width to ensure sufficient target spacingtitle> |
| 6 | + |
| 7 | +<style> |
| 8 | + |
| 9 | +/* =============== Shared pagination styles =============== */ |
| 10 | + |
| 11 | +nav, ol, li, h4 { |
| 12 | + margin: 0; |
| 13 | +} |
| 14 | + |
| 15 | +nav.pag { |
| 16 | + color: black; |
| 17 | + background-color: pink; |
| 18 | +} |
| 19 | + |
| 20 | +.dis { |
| 21 | + color:grey; |
| 22 | + background:white |
| 23 | + } |
| 24 | + |
| 25 | +h4 { |
| 26 | + color: black; |
| 27 | + background-color: #fdf; /* just to indicate the heading area adjacent to the pagination menu above */ |
| 28 | +} |
| 29 | + |
| 30 | +ol.pagination-1, |
| 31 | +ol.pagination-2 { |
| 32 | + list-style-type: none; |
| 33 | +} |
| 34 | + |
| 35 | +ol.results p { |
| 36 | + margin: 0 0 1em 0; |
| 37 | +} |
| 38 | + |
| 39 | +ol.pagination-1 li span, |
| 40 | +ol.pagination-2 li span { |
| 41 | + color:grey; |
| 42 | +} |
| 43 | + |
| 44 | +/* =============== Example 1 pagination styles =============== */ |
| 45 | + |
| 46 | +ol.pagination-1 li { |
| 47 | + display: inline-block; |
| 48 | + min-width: 44px; |
| 49 | + min-height: 44px; |
| 50 | + text-align: center; |
| 51 | + color:black; |
| 52 | + background-color:#fed; /* just to indicate the target spacing area adjacent to the heading below */ |
| 53 | +} |
| 54 | + |
| 55 | +ol.pagination-1 li + li a { |
| 56 | + border-left: 1px solid #bbb; |
| 57 | +} |
| 58 | + |
| 59 | +ol.pagination-1 li a, |
| 60 | +ol.pagination-1 li strong, |
| 61 | +ol.pagination-1 li span { |
| 62 | + display: block; |
| 63 | + margin: 12px; |
| 64 | + padding:4px 8px; |
| 65 | +} |
| 66 | + |
| 67 | +ol.pagination-1 li span { |
| 68 | + padding:4px 0; |
| 69 | +} |
| 70 | + |
| 71 | +ol.pagination-1 li strong { |
| 72 | + color: white; |
| 73 | + background-color: black; |
| 74 | +} |
| 75 | + |
| 76 | +a:hover, |
| 77 | +a:focus { |
| 78 | + outline: 3px solid #c04; |
| 79 | +} |
| 80 | + |
| 81 | +/* =============== Example 2 pagination styles =============== */ |
| 82 | + |
| 83 | +ol.pagination-2 { |
| 84 | +display:flex; |
| 85 | +flex-wrap: wrap; |
| 86 | +} |
| 87 | + |
| 88 | +ol.pagination-2 a, |
| 89 | +ol.pagination-2 strong, |
| 90 | +ol.pagination-2 span { |
| 91 | + display: block; |
| 92 | + line-height:44px; |
| 93 | + border: 2px solid #fff; |
| 94 | + text-align: center; |
| 95 | + min-height:44px; |
| 96 | + min-width: 44px; |
| 97 | + padding: 0 0.2em; |
| 98 | +} |
| 99 | + |
| 100 | +ol.pagination-2 li { |
| 101 | + color:black; |
| 102 | + background-color:#fed; /* just to indicate the target spacing area adjacent to the heading below */ |
| 103 | +} |
| 104 | + |
| 105 | +ol.pagination-2 strong { |
| 106 | + border-top: 3px solid black; |
| 107 | +} |
| 108 | + |
| 109 | +ol.pagination-2 a:hover, |
| 110 | +ol.pagination-2 a:focus { |
| 111 | + outline:none; |
| 112 | + border: 2px solid #c04; |
| 113 | +} |
| 114 | + |
| 115 | + |
| 116 | +style> |
| 117 | + |
| 118 | +head> |
| 119 | + |
| 120 | +<body> |
| 121 | + |
| 122 | +<h1>Working example of using min-height and min-width to ensure sufficient target spacingh1> |
| 123 | + |
| 124 | +<p>This example relates to technique <a href="../../techniques/css/target-padding.html">C42a>.p> |
| 125 | + |
| 126 | +<h2>Example 1 (display: inline-block, min-height: 44px and min-width: 44px set on list items inside pagination menu)h2> |
| 127 | +<p>The first example shows a situation where the targets (in this case, the linked numbers in th pagination menu) are smaller than 44 x 44 CSS pixels. However, the list items that contain them have a minimum height and width of 44 px set, so that sufficient target spacing is assured.p> |
| 128 | +<h3>Search results (invented):h3> |
| 129 | +<nav class="pag" aria-label="pagination menu"> |
| 130 | + <ol class="pagination-1"> |
| 131 | + <li><span>previousspan>li> |
| 132 | + <li><strong>1strong>li> |
| 133 | + <li><a href="#">2a>li> |
| 134 | + <li><a href="#">3a>li> |
| 135 | + <li><a href="#">4a>li> |
| 136 | + <li><a href="#">5a>li> |
| 137 | + <li><a href="#">nexta>li> |
| 138 | + ol> |
| 139 | +nav> |
| 140 | + |
| 141 | +<ol class="results"> |
| 142 | +<li> |
| 143 | +<h4><a href="#">Garbage Delight by Dennis Lee (2014-05-06) (NoDust) by | HC | Gooda>h4> |
| 144 | +<p>HarperCollins, 1800. Condition: Good.p> |
| 145 | +li> |
| 146 | +<li> |
| 147 | +<h4><a href="#">Frederick S Perls: In and out the garbage pail by Frederick S Perls (1969-05-03)a>h4> |
| 148 | +<p>Real People Press, 1804. Shows some signs of wear, and may have some markings on the inside.p> |
| 149 | +li> |
| 150 | +<li> |
| 151 | +<h4><a href="#">Lila Karp: The Queen Is in the Garbage (Classic Feminist Writers) by Lila Karp (2007-05-01) a>h4> |
| 152 | +<p>1838. Condition: Very Good. Published by Belmont Books, 1969.p> |
| 153 | +li> |
| 154 | +ol> |
| 155 | + |
| 156 | + |
| 157 | +<h2>Example 2 (display: flex, min-height: 44px and min-width: 44px set on links inside pagination menu)h2> |
| 158 | +<p>The second example uses min-width and min-height on the targets (the linked numbers in the pagination menu) and not on the parent container, thereby meeting this target spacing Success Criterion <em>andem> the AAA Success Criterion 2.5.5 Target Size.p> |
| 159 | +<h3>Search results (invented):h3> |
| 160 | +<nav class="pag" aria-label="pagination menu"> |
| 161 | + <ol class="pagination-2"> |
| 162 | + <li><span>previousspan>li> |
| 163 | + <li><strong>1strong>li> |
| 164 | + <li><a href="#">2a>li> |
| 165 | + <li><a href="#">3a>li> |
| 166 | + <li><a href="#">4a>li> |
| 167 | + <li><a href="#">5a>li> |
| 168 | + <li><a href="#">nexta>li> |
| 169 | + ol> |
| 170 | +nav> |
| 171 | + |
| 172 | +<ol class="results"> |
| 173 | +<li> |
| 174 | +<h4><a href="#">Garbage Delight by Dennis Lee (2014-05-06) (NoDust) by | HC | Gooda>h4> |
| 175 | +<p>HarperCollins, 1800. Condition: Good.p> |
| 176 | +li> |
| 177 | +<li> |
| 178 | +<h4><a href="#">Frederick S Perls: In and out the garbage pail by Frederick S Perls (1969-05-03)a>h4> |
| 179 | +<p>Real People Press, 1804. Shows some signs of wear, and may have some markings on the inside.p> |
| 180 | +li> |
| 181 | +<li> |
| 182 | +<h4><a href="#">Lila Karp: The Queen Is in the Garbage (Classic Feminist Writers) by Lila Karp (2007-05-01) a>h4> |
| 183 | +<p>1838. Condition: Very Good. Published by Belmont Books, 1969.p> |
| 184 | +li> |
| 185 | +ol> |
| 186 | + |
| 187 | +body> |
| 188 | +html> |
0 commit comments