|
| 1 | +--- |
| 2 | +id: 66bba6fff611169359d9d36a |
| 3 | +title: Build a Confidential Email Page |
| 4 | +challengeType: 14 |
| 5 | +dashedName: build-a-confidential-email-page |
| 6 | +demoType: onClick |
| 7 | +--- |
| 8 | + |
| 9 | +# --description-- |
| 10 | + |
| 11 | +**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab. |
| 12 | + |
| 13 | +**User Stories:** |
| 14 | + |
| 15 | +1. You should have a `main` element with an `id` of `email`. |
| 16 | +1. Your `#email` element should have `padding` of `50px`, a top margin of `50px`, a `width` of `500px`, and a `border` that's `2px`. |
| 17 | +1. The total width of your `#email` element, including paddings and borders, should be `500px`. |
| 18 | +1. You should have two `div` elements, one with an id of `confidential` and the other with an id of `top-secret`, within your `#email` element. |
| 19 | +1. Your `#confidential` and `#top-secret` elements should have a `display` of `inline-block`. |
| 20 | +1. Your `#confidential` and `#top-secret` elements should have a `padding`, a left margin, and a `border`. |
| 21 | +1. Your `#confidential` and `#top-secret` elements should be rotated using a CSS transform. |
| 22 | +1. You should have at least three paragraph elements within your `#email` element. |
| 23 | +1. You should have at least three `span` elements with a class of `blurred`, within your paragraph elements. |
| 24 | +1. You should have a `blurred` selector that blurs the element `3px` using a CSS filter. |
| 25 | + |
| 26 | +# --hints-- |
| 27 | + |
| 28 | +You should have a `main` element with an `id` of `email`. |
| 29 | + |
| 30 | +```js |
| 31 | +assert.exists(document.querySelector('main#email')); |
| 32 | +``` |
| 33 | + |
| 34 | +You should have an `#email` selector that sets its elements' `padding` on all sides to `50px`. |
| 35 | + |
| 36 | +```js |
| 37 | +assert.equal(new __helpers.CSSHelp(document).getStyle('#email')?.getPropertyValue('padding'), '50px'); |
| 38 | +``` |
| 39 | +
|
| 40 | +You should have an `#email` selector that sets its elements' `margin-top` to `50px`. |
| 41 | +
|
| 42 | +```js |
| 43 | +assert.equal(new __helpers.CSSHelp(document).getStyle('#email')?.getPropertyValue('margin-top'), '50px'); |
| 44 | +``` |
| 45 | +
|
| 46 | +You should have an `#email` selector that sets its elements' `width` to `500px`. |
| 47 | +
|
| 48 | +```js |
| 49 | +assert.equal(new __helpers.CSSHelp(document).getStyle('#email')?.getPropertyValue('width'), '500px'); |
| 50 | +``` |
| 51 | +
|
| 52 | +Your `#email` element should have a `2px` border. |
| 53 | +
|
| 54 | +```js |
| 55 | +assert.equal(new __helpers.CSSHelp(document).getStyle('#email')?.getPropertyValue('border-width'), '2px'); |
| 56 | +``` |
| 57 | +
|
| 58 | +Your `#email` element should have a `box-sizing` of `border-box`. |
| 59 | +
|
| 60 | +```js |
| 61 | +assert.equal(new __helpers.CSSHelp(document).getStyle('#email')?.boxSizing, 'border-box'); |
| 62 | +``` |
| 63 | +
|
| 64 | +You should have a `div` element with an `id` of `confidential` within your `#email` element. |
| 65 | +
|
| 66 | +```js |
| 67 | +assert.exists(document.querySelector('#email > div#confidential')); |
| 68 | +``` |
| 69 | +
|
| 70 | +You should have a `div` element with an `id` of `top-secret` within your `#email` element. |
| 71 | +
|
| 72 | +```js |
| 73 | +assert.exists(document.querySelector('#email > div#top-secret')); |
| 74 | +``` |
| 75 | +
|
| 76 | +Your `#confidential` element should have its `display` set to `inline-block`. |
| 77 | +
|
| 78 | +```js |
| 79 | +assert.equal(window.getComputedStyle(document.querySelector('#confidential'))?.display, 'inline-block'); |
| 80 | +``` |
| 81 | +
|
| 82 | +Your `#top-secret` element should have its `display` set to `inline-block`. |
| 83 | +
|
| 84 | +```js |
| 85 | +assert.equal(window.getComputedStyle(document.querySelector('#top-secret'))?.display, 'inline-block'); |
| 86 | +``` |
| 87 | +
|
| 88 | +Your `#confidential` element should have a `padding` on all sides. |
| 89 | +
|
| 90 | +```js |
| 91 | +const style = window.getComputedStyle(document.querySelector('#confidential')); |
| 92 | +assert.notEqual(style?.paddingTop, '0px'); |
| 93 | +assert.notEqual(style?.paddingRight, '0px'); |
| 94 | +assert.notEqual(style?.paddingBottom, '0px'); |
| 95 | +assert.notEqual(style?.paddingLeft, '0px'); |
| 96 | +``` |
| 97 | +
|
| 98 | +Your `#top-secret` element should have a `padding` on all sides. |
| 99 | +
|
| 100 | +```js |
| 101 | +const style = window.getComputedStyle(document.querySelector('#top-secret')); |
| 102 | +assert.notEqual(style?.paddingTop, '0px'); |
| 103 | +assert.notEqual(style?.paddingRight, '0px'); |
| 104 | +assert.notEqual(style?.paddingBottom, '0px'); |
| 105 | +assert.notEqual(style?.paddingLeft, '0px'); |
| 106 | +``` |
| 107 | +
|
| 108 | +Your `#confidential` element should have a left margin. |
| 109 | +
|
| 110 | +```js |
| 111 | +assert.notEqual(window.getComputedStyle(document.querySelector('#confidential'))?.marginLeft, '0px'); |
| 112 | +``` |
| 113 | +
|
| 114 | +Your `#top-secret` element should have a left margin. |
| 115 | +
|
| 116 | +```js |
| 117 | +assert.notEqual(window.getComputedStyle(document.querySelector('#top-secret'))?.marginLeft, '0px'); |
| 118 | +``` |
| 119 | +
|
| 120 | +Your `#confidential` element should have a `border`. |
| 121 | +
|
| 122 | +```js |
| 123 | +assert.notEqual(window.getComputedStyle(document.querySelector('#confidential'))?.borderWidth, '0px'); |
| 124 | +``` |
| 125 | +
|
| 126 | +Your `#top-secret` element should have a `border`. |
| 127 | +
|
| 128 | +```js |
| 129 | +assert.notEqual(window.getComputedStyle(document.querySelector('#top-secret'))?.borderWidth, '0px'); |
| 130 | +``` |
| 131 | +
|
| 132 | +Your `#confidential` element should use a CSS `transform` to rotate the element. |
| 133 | +
|
| 134 | +```js |
| 135 | +assert.notEqual(window.getComputedStyle(document.querySelector('#confidential'))?.transform, 'none'); |
| 136 | +``` |
| 137 | +
|
| 138 | +Your `#top-secret` element should use a CSS `transform` to rotate the element. |
| 139 | +
|
| 140 | +```js |
| 141 | +assert.notEqual(window.getComputedStyle(document.querySelector('#top-secret'))?.transform, 'none'); |
| 142 | +``` |
| 143 | +
|
| 144 | +You should have at least three paragraph elements within your `#email` element. |
| 145 | +
|
| 146 | +```js |
| 147 | +assert.isAtLeast(document.querySelectorAll('#email > p').length, 3); |
| 148 | +``` |
| 149 | +
|
| 150 | +You should have at least three `span` elements with a class of `blurred` within your paragraphs. |
| 151 | +
|
| 152 | +```js |
| 153 | +assert.isAtLeast(document.querySelectorAll('p > span.blurred').length, 3); |
| 154 | +``` |
| 155 | +
|
| 156 | +Your `.blurred` elements should not be empty. |
| 157 | +
|
| 158 | +```js |
| 159 | +const els = document.querySelectorAll('.blurred'); |
| 160 | +assert.isAtLeast(els.length, 1); |
| 161 | +els.forEach(el => assert.isAtLeast(el.innerText.length , 1)) |
| 162 | +``` |
| 163 | +
|
| 164 | +You should have a `.blurred` selector that set its elements `filter` to `blur(3px)`. |
| 165 | +
|
| 166 | +```js |
| 167 | +assert.equal(new __helpers.CSSHelp(document).getStyle('.blurred')?.filter, 'blur(3px)'); |
| 168 | +``` |
| 169 | +
|
| 170 | +# --seed-- |
| 171 | +
|
| 172 | +## --seed-contents-- |
| 173 | +
|
| 174 | +```html |
| 175 | +<!DOCTYPE html> |
| 176 | +<html lang="en"> |
| 177 | + |
| 178 | +<head> |
| 179 | + <meta charset="UTF-8"> |
| 180 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 181 | + <title>Confidential Email</title> |
| 182 | + |
| 183 | +</head> |
| 184 | + |
| 185 | +<body> |
| 186 | + |
| 187 | +</body> |
| 188 | + |
| 189 | +</html> |
| 190 | +``` |
| 191 | +
|
| 192 | +```css |
| 193 | + |
| 194 | +``` |
| 195 | +
|
| 196 | +# --solutions-- |
| 197 | +
|
| 198 | +```html |
| 199 | +<!DOCTYPE html> |
| 200 | +<html lang="en"> |
| 201 | + |
| 202 | +<head> |
| 203 | + <meta charset="UTF-8"> |
| 204 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 205 | + <title>Secret Marshmallow Mission</title> |
| 206 | + <link rel="stylesheet" href="styles.css"> |
| 207 | +</head> |
| 208 | + |
| 209 | +<body> |
| 210 | + <main id="email"> |
| 211 | + <div id="confidential">CONFIDENTIAL</div> |
| 212 | + <p>Dear Agent <span class="blurred">S'more,</span></p> |
| 213 | + <p>We have an emergency. The secret formula for our <span class="blurred">Mega Marshmallow</span> has been |
| 214 | + compromised. This formula is what makes our marshmallows the fluffiest and most delicious.</p> |
| 215 | + <p>We suspect that <span class="blurred">Professor Puff</span> is behind this. He has taken the formula to his |
| 216 | + hidden laboratory. Your mission is to infiltrate the lab and secure the formula before it's too late.</p> |
| 217 | + <p>Be sure to keep the lab's location confidential. Any leak of this information could jeopardize the entire |
| 218 | + operation.</p> |
| 219 | + <div id="top-secret">TOP SECRET</div> |
| 220 | + </main> |
| 221 | +</body> |
| 222 | +
|
| 223 | +</html> |
| 224 | +``` |
| 225 | +
|
| 226 | +```css |
| 227 | +#email { |
| 228 | + background-color: SeaShell; |
| 229 | + margin: 50px auto; |
| 230 | + padding: 50px; |
| 231 | + width: 500px; |
| 232 | + border: 2px solid black; |
| 233 | + box-shadow: 5px 3px 3px gray; |
| 234 | + box-sizing: border-box; |
| 235 | +} |
| 236 | +
|
| 237 | +#confidential { |
| 238 | + display: inline-block; |
| 239 | + margin-left: 100px; |
| 240 | + padding: 10px; |
| 241 | + text-align: center; |
| 242 | + font-size: 30px; |
| 243 | + transform: rotate(-20deg); |
| 244 | + color: red; |
| 245 | + border: 5px solid red; |
| 246 | + font-weight: bold; |
| 247 | +} |
| 248 | +
|
| 249 | +#top-secret { |
| 250 | + margin-left: 200px; |
| 251 | + display: inline-block; |
| 252 | + padding: 10px; |
| 253 | + text-align: center; |
| 254 | + font-size: 20px; |
| 255 | + transform: rotate(15deg); |
| 256 | + color: red; |
| 257 | + border: 5px solid red; |
| 258 | + font-weight: bold; |
| 259 | +} |
| 260 | +
|
| 261 | +.blurred { |
| 262 | + filter: blur(3px); |
| 263 | +} |
| 264 | +``` |
0 commit comments