fix(learn): implement box-sizing correctly (#49578)

fix(learn): implement box sizing correctly
This commit is contained in:
Lasse Jørgensen
2023-03-21 13:58:24 +05:30
committed by GitHub
parent 5a2b5f1ed2
commit 4617011edb
55 changed files with 63 additions and 62 deletions
@@ -7,7 +7,9 @@ dashedName: step-26
# --description--
To start your CSS, normalize the CSS rules by targeting all elements with `*`, including the `::before` and `::after` pseudo-selectors. Set the `padding` property and `margin` property both to `0`.
To start your CSS, normalize the CSS rules by targeting all elements with `*`, including the `::before` and `::after` pseudo-selectors.
Set the `padding` and `margin` properties both to `0` and set the `box-sizing` property to `border-box`.
# --hints--
@@ -29,6 +31,12 @@ Your `*, ::before, ::after` selector should have a `margin` property set to `0`.
assert(new __helpers.CSSHelp(document).getStyle('*, ::before, ::after')?.margin === '0px');
```
Your `*, ::before, ::after` selector should have a `box-sizing` property set to `border-box`.
```js
assert(new __helpers.CSSHelp(document).getStyle('*, ::before, ::after')?.boxSizing === 'border-box');
```
# --seed--
## --seed-contents--
@@ -11,8 +11,6 @@ Create an `html` selector and give it a `font-size` property set to `62.5%`. Thi
This will make it easier for you to work with `rem` units later, as `2rem` would be 20px.
Also, set the `box-sizing` property to `border-box`.
# --hints--
You should create an `html` selector.
@@ -27,12 +25,6 @@ Your `html` selector should have a `font-size` property set to `62.5%`.
assert(new __helpers.CSSHelp(document).getStyle('html')?.fontSize === '62.5%');
```
Your `html` selector should have a `box-sizing` property set to `border-box`.
```js
assert(new __helpers.CSSHelp(document).getStyle('html')?.boxSizing === 'border-box');
```
# --seed--
## --seed-contents--
@@ -218,6 +210,7 @@ assert(new __helpers.CSSHelp(document).getStyle('html')?.boxSizing === 'border-b
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
--fcc-editable-region--
@@ -221,11 +221,11 @@ assert(new __helpers.CSSHelp(document).getStyle('body')?.backgroundColor === 'rg
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
--fcc-editable-region--
@@ -209,11 +209,11 @@ assert(fontFamily === 'Anton, sans-serif' || fontFamily === `"Anton", sans-serif
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(fontFamily === 'Raleway, sans-serif' || fontFamily === `"Raleway", sans-s
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -214,11 +214,11 @@ assert(new __helpers.CSSHelp(document).getStyle('a')?.color === 'linen');
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -210,11 +210,11 @@ assert(new __helpers.CSSHelp(document).getStyle('main')?.display === 'grid');
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -204,11 +204,11 @@ assert(new __helpers.CSSHelp(document).getStyle('main')?.gridTemplateColumns ===
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -204,11 +204,11 @@ assert(new __helpers.CSSHelp(document).getStyle('main')?.gridTemplateColumns ===
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -202,11 +202,11 @@ assert(new __helpers.CSSHelp(document).getStyle('main')?.rowGap === '3rem');
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -212,11 +212,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.heading')?.gridColumn === '2 /
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -208,11 +208,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.text')?.gridColumn === '2 / 3'
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -204,11 +204,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.heading')?.display === 'grid')
*, ::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -208,11 +208,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.heading')?.gridTemplateColumns
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -204,11 +204,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.heading')?.rowGap === '1.5rem'
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -212,11 +212,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.hero')?.gridColumn === '1 / -1
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -204,11 +204,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.hero')?.position === 'relative
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -217,11 +217,11 @@ assert(new __helpers.CSSHelp(document).getStyle('img')?.objectFit === 'cover');
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -221,11 +221,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.hero-title')?.fontSize === '8r
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -221,11 +221,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.hero-subtitle')?.textAlign ===
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -216,11 +216,11 @@ assert(fontFamily === 'Raleway, sans-serif' || fontFamily === `"Raleway", sans-s
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -211,11 +211,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.author-name a:hover')?.backgro
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.publish-date')?.color === 'rgb
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -215,11 +215,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.social-icons')?.fontSize === '
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -203,11 +203,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.social-icons')?.gridTemplateCo
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -207,11 +207,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.social-icons')?.gridAutoFlow =
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -205,11 +205,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.social-icons')?.gridAutoColumn
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -205,11 +205,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.social-icons')?.alignItems ===
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.text')?.letterSpacing === '0.6
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -205,11 +205,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.text')?.columnWidth === '25rem
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -205,11 +205,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.text')?.textAlign === 'justify
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -217,11 +217,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.first-paragraph::first-letter'
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.first-paragraph::first-letter'
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('hr')?.margin === '1.5rem 0px');
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -205,11 +205,11 @@ assert.equal(new __helpers.CSSHelp(document).getStyle('hr')?.borderColor, 'rgba(
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -221,11 +221,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.quote')?.textAlign === 'center
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -204,11 +204,11 @@ assert(fontFamily === 'Raleway, sans-serif' || fontFamily === `"Raleway", sans-s
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -225,11 +225,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.quote::after')?.content?.match
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -211,11 +211,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.text-with-images')?.display ==
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.text-with-images')?.columnGap
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -203,11 +203,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.text-with-images')?.marginBott
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.lists')?.listStyleType === 'no
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -203,11 +203,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.lists')?.marginTop === '2rem')
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.lists li')?.marginBottom === '
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.list-title, .list-subtitle')?.
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -211,11 +211,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.image-wrapper')?.display === '
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -211,11 +211,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.image-wrapper')?.gridTemplateR
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -205,11 +205,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.image-wrapper')?.gap === '2rem
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -205,11 +205,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.image-wrapper')?.placeItems ==
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -209,11 +209,11 @@ assert(new __helpers.CSSHelp(document).getStyle('.image-1, .image-3')?.gridColum
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -219,11 +219,11 @@ assert(new __helpers.CSSHelp(document).getCSSRules('media')?.[0]?.cssRules?.[0]?
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -217,11 +217,11 @@ assert(new __helpers.CSSHelp(document).getCSSRules('media')?.[1]?.cssRules?.[0]?
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -236,11 +236,11 @@ assert(new __helpers.CSSHelp(document).getCSSRules('media')?.[2]?.cssRules?.[3]?
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -217,11 +217,11 @@ assert(new __helpers.CSSHelp(document).getCSSRules('media')?.[3]?.cssRules?.[0]?
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {
@@ -206,11 +206,11 @@ assert.isNull(document.querySelector('.hero-img')?.getAttribute('width'));
::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
box-sizing: border-box;
}
body {