|
1 | 1 | body { |
2 | 2 | margin: 20px; |
| 3 | + /* Adds margin around the body */ |
3 | 4 | background-color: lightgray; |
4 | 5 | } |
5 | 6 |
|
@@ -27,3 +28,255 @@ body { |
27 | 28 | position: relative; |
28 | 29 | padding: 50px; |
29 | 30 | } |
| 31 | + |
| 32 | +.text { |
| 33 | + position: absolute; |
| 34 | + top: 50%; |
| 35 | + left: -120px; |
| 36 | + transform: translateY(-50%); |
| 37 | + font-size: 20px; |
| 38 | + padding-bottom: 3px; |
| 39 | + color: red; |
| 40 | + border-bottom: 3px solid red; |
| 41 | +} |
| 42 | + |
| 43 | +.text2 { |
| 44 | + position: absolute; |
| 45 | + top: -30px; |
| 46 | + left: 50%; |
| 47 | + transform: translateX(-50%); |
| 48 | + font-size: 20px; |
| 49 | +} |
| 50 | + |
| 51 | +.text3 { |
| 52 | + position: absolute; |
| 53 | + top: 10px; |
| 54 | + left: 10px; |
| 55 | + font-size: 20px; |
| 56 | +} |
| 57 | + |
| 58 | +.text4 { |
| 59 | + position: absolute; |
| 60 | + top: 50%; |
| 61 | + left: 50%; |
| 62 | + transform: translate(-50%, -50%); |
| 63 | + color: red; |
| 64 | + font-size: 20px; |
| 65 | +} |
| 66 | + |
| 67 | +/* Container for content-box vs. border-box demonstration */ |
| 68 | +.container { |
| 69 | + background-color: #adb5bd; |
| 70 | + width: 800px; |
| 71 | + margin-bottom: 50px; |
| 72 | +} |
| 73 | + |
| 74 | +/* Item with content-box box-sizing (default) */ |
| 75 | +.item1 { |
| 76 | + background-color: lightgreen; |
| 77 | + width: 100px; |
| 78 | + height: 100px; |
| 79 | + padding: 10px; |
| 80 | + box-sizing: content-box; |
| 81 | + border: 5px solid red; |
| 82 | +} |
| 83 | + |
| 84 | +/* Item with border-box box-sizing */ |
| 85 | +.item2 { |
| 86 | + background-color: lightcoral; |
| 87 | + width: 100px; |
| 88 | + height: 100px; |
| 89 | + padding: 10px; |
| 90 | + box-sizing: border-box; |
| 91 | + border: 5px solid rgb(114, 0, 0); |
| 92 | +} |
| 93 | + |
| 94 | +.item3 { |
| 95 | + background-color: lightgoldenrodyellow; |
| 96 | + width: 100px; |
| 97 | + height: 100px; |
| 98 | +} |
| 99 | + |
| 100 | +.item4 { |
| 101 | + background-color: lightseagreen; |
| 102 | + width: 100px; |
| 103 | + height: 100px; |
| 104 | +} |
| 105 | + |
| 106 | +/* Flexbox container, centered on the page */ |
| 107 | +.container2 { |
| 108 | + background-color: #adb5bd; |
| 109 | + width: 800px; |
| 110 | + display: flex; |
| 111 | + margin: 0 auto; |
| 112 | + margin-bottom: 50px; |
| 113 | +} |
| 114 | + |
| 115 | +.item5 { |
| 116 | + background-color: lightgreen; |
| 117 | + width: 100px; |
| 118 | + height: 100px; |
| 119 | +} |
| 120 | + |
| 121 | +.item6 { |
| 122 | + background-color: lightcoral; |
| 123 | + width: 100px; |
| 124 | + height: 100px; |
| 125 | +} |
| 126 | + |
| 127 | +.item7 { |
| 128 | + background-color: lightgoldenrodyellow; |
| 129 | + width: 100px; |
| 130 | + height: 100px; |
| 131 | +} |
| 132 | + |
| 133 | +.item8 { |
| 134 | + background-color: lightseagreen; |
| 135 | + width: 100px; |
| 136 | + height: 100px; |
| 137 | +} |
| 138 | + |
| 139 | +/* Flexbox container with justify-content properties */ |
| 140 | +.container3 { |
| 141 | + background-color: #adb5bd; |
| 142 | + width: 800px; |
| 143 | + display: flex; |
| 144 | + justify-content: center; |
| 145 | + justify-content: space-between; |
| 146 | + margin-bottom: 50px; |
| 147 | +} |
| 148 | + |
| 149 | +.item9 { |
| 150 | + background-color: lightgreen; |
| 151 | + width: 100px; |
| 152 | + height: 100px; |
| 153 | +} |
| 154 | + |
| 155 | +.item10 { |
| 156 | + background-color: lightcoral; |
| 157 | + width: 100px; |
| 158 | + height: 100px; |
| 159 | +} |
| 160 | + |
| 161 | +.item11 { |
| 162 | + background-color: lightgoldenrodyellow; |
| 163 | + width: 100px; |
| 164 | + height: 100px; |
| 165 | +} |
| 166 | + |
| 167 | +.item12 { |
| 168 | + background-color: lightseagreen; |
| 169 | + width: 100px; |
| 170 | + height: 100px; |
| 171 | +} |
| 172 | + |
| 173 | +/* Flexbox container with column direction */ |
| 174 | +.container4 { |
| 175 | + background-color: #adb5bd; |
| 176 | + width: 800px; |
| 177 | + display: flex; |
| 178 | + flex-direction: column; |
| 179 | + margin-bottom: 50px; |
| 180 | +} |
| 181 | + |
| 182 | +.item13 { |
| 183 | + background-color: lightgreen; |
| 184 | + /* width: 100px; */ |
| 185 | + height: 100px; |
| 186 | +} |
| 187 | + |
| 188 | +.item14 { |
| 189 | + background-color: lightcoral; |
| 190 | + /* width: 100px; */ |
| 191 | + height: 100px; |
| 192 | +} |
| 193 | + |
| 194 | +.item15 { |
| 195 | + background-color: lightgoldenrodyellow; |
| 196 | + /* width: 100px; */ |
| 197 | + height: 100px; |
| 198 | +} |
| 199 | + |
| 200 | +.item16 { |
| 201 | + background-color: lightseagreen; |
| 202 | + /* width: 100px; */ |
| 203 | + height: 100px; |
| 204 | +} |
| 205 | + |
| 206 | +/* Flexbox container with wrapping enabled */ |
| 207 | +.container5 { |
| 208 | + background-color: #adb5bd; |
| 209 | + width: 800px; |
| 210 | + display: flex; |
| 211 | + flex-wrap: wrap; |
| 212 | +} |
| 213 | + |
| 214 | +.item17 { |
| 215 | + background-color: lightgreen; |
| 216 | + width: 100px; |
| 217 | + height: 100px; |
| 218 | + border: 1px solid #000; |
| 219 | +} |
| 220 | + |
| 221 | +.item18 { |
| 222 | + background-color: lightcoral; |
| 223 | + width: 100px; |
| 224 | + height: 100px; |
| 225 | + border: 1px solid #000; |
| 226 | +} |
| 227 | + |
| 228 | +.item19 { |
| 229 | + background-color: lightgoldenrodyellow; |
| 230 | + width: 100px; |
| 231 | + height: 100px; |
| 232 | + border: 1px solid #000; |
| 233 | +} |
| 234 | + |
| 235 | +.item20 { |
| 236 | + background-color: lightseagreen; |
| 237 | + width: 100px; |
| 238 | + height: 100px; |
| 239 | + border: 1px solid #000; |
| 240 | +} |
| 241 | + |
| 242 | +.item21 { |
| 243 | + background-color: lightgreen; |
| 244 | + width: 100px; |
| 245 | + height: 100px; |
| 246 | + border: 1px solid #000; |
| 247 | +} |
| 248 | + |
| 249 | +.item22 { |
| 250 | + background-color: lightcoral; |
| 251 | + width: 100px; |
| 252 | + height: 100px; |
| 253 | + border: 1px solid #000; |
| 254 | +} |
| 255 | + |
| 256 | +.item23 { |
| 257 | + background-color: lightgoldenrodyellow; |
| 258 | + width: 100px; |
| 259 | + height: 100px; |
| 260 | + border: 1px solid #000; |
| 261 | +} |
| 262 | + |
| 263 | +.item24 { |
| 264 | + background-color: lightseagreen; |
| 265 | + width: 100px; |
| 266 | + height: 100px; |
| 267 | + border: 1px solid #000; |
| 268 | +} |
| 269 | + |
| 270 | +.item25 { |
| 271 | + background-color: lightgreen; |
| 272 | + width: 100px; |
| 273 | + height: 100px; |
| 274 | + border: 1px solid #000; |
| 275 | +} |
| 276 | + |
| 277 | +.item26 { |
| 278 | + background-color: lightcoral; |
| 279 | + width: 100px; |
| 280 | + height: 100px; |
| 281 | + border: 1px solid #000; |
| 282 | +} |
0 commit comments