diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index 157a857e268..d8e83c2cd5c 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -946,6 +946,14 @@ "top-build-a-recipe-project": { "title": "Learn HTML Foundations by Building a Recipe Page", "intro": ["A description is to be determined"] + }, + "top-learn-css-foundations": { + "title": "Learn CSS Foundations", + "intro": ["A description is to be determined"] + }, + "top-learn-css-foundations-projects": { + "title": "Learn CSS Foundations Projects", + "intro": ["A description is to be determined"] } } }, diff --git a/client/src/pages/learn/the-odin-project/top-learn-css-foundations/index.md b/client/src/pages/learn/the-odin-project/top-learn-css-foundations/index.md new file mode 100644 index 00000000000..39bc4dc70b8 --- /dev/null +++ b/client/src/pages/learn/the-odin-project/top-learn-css-foundations/index.md @@ -0,0 +1,9 @@ +--- +title: The Odin Project +superBlock: the-odin-project +certification: the-odin-project +--- + +## The Odin project + +Description is to be determined diff --git a/client/utils/help-category-map.json b/client/utils/help-category-map.json index 4b1e3c52c65..d2d11f57fba 100644 --- a/client/utils/help-category-map.json +++ b/client/utils/help-category-map.json @@ -43,6 +43,8 @@ "data-structures": "JavaScript", "take-home-projects": "JavaScript", "top-learn-html-foundations": "HTML-CSS", + "top-learn-css-foundations": "HTML-CSS", + "top-learn-css-foundations-projects": "HTML-CSS", "top-build-a-recipe-project": "HTML-CSS", "rosetta-code": "JavaScript", "project-euler-problems-1-to-100": "JavaScript", diff --git a/curriculum/challenges/_meta/top-learn-css-foundations-projects/meta.json b/curriculum/challenges/_meta/top-learn-css-foundations-projects/meta.json new file mode 100644 index 00000000000..75bfbe1fe5a --- /dev/null +++ b/curriculum/challenges/_meta/top-learn-css-foundations-projects/meta.json @@ -0,0 +1,31 @@ +{ + "name": "TOP Learn CSS Foundations Projects", + "isUpcomingChange": true, + "order": 3, + "time": "", + "template": "", + "required": [], + "superBlock": "the-odin-project", + "challengeOrder": [ + [ + "63ee3f71381756f9716727ef", + "CSS Foundations Exercise A" + ], + [ + "63ee3fe4381756f9716727f0", + "CSS Foundations Exercise B" + ], + [ + "63ee3fe9381756f9716727f1", + "CSS Foundations Exercise C" + ], + [ + "63ee3ff1381756f9716727f2", + "CSS Foundations Exercise D" + ], + [ + "63ee3ff8381756f9716727f3", + "CSS Foundations Exercise E" + ] + ] +} diff --git a/curriculum/challenges/_meta/top-learn-css-foundations/meta.json b/curriculum/challenges/_meta/top-learn-css-foundations/meta.json new file mode 100644 index 00000000000..acca9f4ee5c --- /dev/null +++ b/curriculum/challenges/_meta/top-learn-css-foundations/meta.json @@ -0,0 +1,43 @@ +{ + "name": "TOP Learn CSS Foundations", + "isUpcomingChange": true, + "order": 2, + "time": "", + "template": "", + "required": [], + "superBlock": "the-odin-project", + "challengeOrder": [ + [ + "63ee351d0d8d4841c3a7091a", + "CSS Foundations Question A" + ], + [ + "63ee35240d8d4841c3a7091b", + "CSS Foundations Question B" + ], + [ + "63ee352b0d8d4841c3a7091c", + "CSS Foundations Question C" + ], + [ + "63ee35300d8d4841c3a7091d", + "CSS Foundations Question D" + ], + [ + "63ee35370d8d4841c3a7091e", + "CSS Foundations Question E" + ], + [ + "63ee353e0d8d4841c3a7091f", + "CSS Foundations Question F" + ], + [ + "63ee35450d8d4841c3a70920", + "CSS Foundations Question G" + ], + [ + "63ee354c0d8d4841c3a70921", + "CSS Foundations Question H" + ] + ] +} diff --git a/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-a.md b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-a.md new file mode 100644 index 00000000000..e3bc9cb0b7d --- /dev/null +++ b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-a.md @@ -0,0 +1,195 @@ +--- +id: 63ee3f71381756f9716727ef +title: CSS Foundations Exercise A +challengeType: 14 +dashedName: css-foundations-exercise-a +--- + +# --description-- + +**Objective:** +In this exercise, you're going to practice adding CSS to an HTML file using all three methods: external CSS, internal CSS, and inline CSS. You should only be using type selectors for this exercise when adding styles via the external and internal methods. You should also use keywords for colors (e.g. "blue") instead of using `RGB` or `HEX` values. + +## User Stories + +1. You should see a `div` element with a `red` background, `white` text, a font size of `32px`, center aligned, and `bold`. + +1. The CSS of the `div` element should be added externally by using a type selector. + +1. You should see a `p` element with a `green` background, `white` text, and a font size of `18px`. + +1. The CSS of the `p` element should be added internally by using a type selector. + +1. You should see a `button` element with an orange background and a font size of `18px`. + +1. The CSS of the `button` element should have an inline style. + +# --hints-- + +There should be one `div` element and should contains some text and be aligned in the center. + +```js +const aligned = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('text-align'); + +assert(aligned === 'center'); +assert(document.getElementsByTagName('DIV')?.length == 1); +assert(document.getElementsByTagName('DIV')?.[0]?.innerText.length > 0) +``` + +The `div` element should have a `background-color` of `red` and a text color of `white`. + +```js + +const bgc = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('background-color'); + +const color = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('color'); + +assert(bgc === 'red'); +assert(color === 'white'); +``` + +The `div` element should have a `font-weight` of bold and a `font-size` of `32px`. + +```js +const fontSize = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('font-size'); +const fontWeight = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('font-weight'); + +assert(fontSize === '32px'); +assert(fontWeight === 'bold'); +``` + +The `div` element should have its CSS added externally. + +```js +assert(!document.getElementsByTagName('style')?.[0]?.innerText.includes('div')); +assert(!document.getElementsByTagName('div')?.[0]?.hasAttribute('style')); +``` + +There should be one `p` element and it should contain some text. + +```js +assert(document.getElementsByTagName('P')?.length == 1); +assert(document.getElementsByTagName('P')?.[0]?.innerText.length > 0) +``` + +The `p` element should have its `color` set to `white`. + +```js +const color = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('color'); + +assert(color == 'white'); +``` + +The `p` element should have a `font-size` of `18px`. + +```js +const styleTag = document.getElementsByTagName('style')?.[0]; +let pHasFontSize18 = false; + +const rules = styleTag?.sheet?.cssRules || styleTag?.sheet?.rules; +if (rules) { + for (let j = 0; j < rules.length; j++) { + const rule = rules[j]; + if (rule.selectorText === 'p' && rule.style.fontSize === '18px') { + pHasFontSize18 = true; + break; + } + } +} + +assert(pHasFontSize18); +``` + +The `p` element should have its style added internally. + +```js + +const styleTag = document.getElementsByTagName('style')?.[0]; +let pIsStyled = false; + + +const rules = styleTag?.sheet?.cssRules || styleTag?.sheet?.rules; +if (rules) { + for (let j = 0; j < rules.length; j++) { + const rule = rules[j]; + if (rule.selectorText === 'p') { + pIsStyled = true; + break; + } + } +} + +assert(pIsStyled); +``` + +The `button` element should have its `background-color` set to `orange`. + +```js +assert(document.getElementsByTagName('button')?.[0]?.style.backgroundColor === 'orange') +``` + +The `button` element should have its `font-size` set to `18px`. + +```js +assert(document.getElementsByTagName('button')?.[0]?.style.fontSize === '18px') +``` + +The `button` element should have an inline style. + +```js +assert(document.getElementsByTagName('button')?.[0]?.hasAttribute('style')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +
+This is a paragraph.
+ + + +``` + +```css +div { + background-color: red; + color: white; + font-size: 32px; + text-align: center; + font-weight: bold; +} +``` diff --git a/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-b.md b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-b.md new file mode 100644 index 00000000000..38c03b7fce3 --- /dev/null +++ b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-b.md @@ -0,0 +1,172 @@ +--- +id: 63ee3fe4381756f9716727f0 +title: CSS Foundations Exercise B +challengeType: 14 +dashedName: css-foundations-exercise-b +--- + +# --description-- + +**Objective:** There are several elements in the HTML file provided, which you will have to add either class or ID attributes to. You will then have to add rules in the CSS file provided using the correct selector syntax. + +## User Stories + +1. You should see a `yellow` background for all odd numbered elements in the list. + +1. You should have a `class` selector used for all odd numbered elements in the list. + +1. You should see that the second element in the list has `blue` text and a `font-size` of `36px`. + +1. The `font-size` and text color on the second element should be set by using an `id` attribute. + +1. You should see that the third element in the list has a `font-size` of `24px`. + +1. The `font-size` on the third element should be set by using a `class` attribute. + +1. You should see that the fourth element in the list has a `red` background, a `font-size` of `24px`, and a `font-weight` of `bold`. + +1. The `font-size` of the fourth element should be set with a `class` attribute the `font-weight` and the color should be set with an `id` attribute. + +# --hints-- + +Every odd element should have a `class` attribute. + +```js +const p = Array.from(document.querySelectorAll('P')); + +const everyPHasClass = p?.every((paragraph) => paragraph.classList.length > 0); + +assert(everyPHasClass); +``` + +Your odd elements should have a `background-color` of `yellow`. + +```js +const p = Array.from(document.querySelectorAll('P')); + +const everyPhasBackgroundColor = p?.every((paragraph) => { + + const style = getComputedStyle(paragraph); + + return style?.backgroundColor === 'rgb(255, 255, 0)'; +}) +``` + +Your second element should have blue text and a `font-size` of `36px`. + +```js +const secondElementId = document.querySelectorAll('div')?.[0]?.id; + +const style = new __helpers.CSSHelp(document).getStyle(`#${secondElementId}`); + +assert.equal(style?.color, 'rgb(0, 0, 255)') +assert.equal(style?.fontSize, '36px'); +``` + +Your third element should have text and a `font-size` of `24px`. + +```js +const thirdElement = document.querySelectorAll('p')?.[1]?.classList; + +``` + +The fourth element should have a `font-size` of `24px`. + +```js +const fourthElementClass = document.querySelectorAll('div')?.[1]?.classList[0]; + +const style = new __helpers.CSSHelp(document).getStyle(`.${fourthElementClass}`); + +assert(style?.fontSize === '24px'); +``` + +The fourth element should have a red `background-color`. + +```js +const fourthElement = document.querySelectorAll('div')?.[1]?.id; + +const style = new __helpers.CSSHelp(document).getStyle(`#${fourthElement}`); + +assert(style?.backgroundColor === 'red'); +``` + +The fourth element should have a `font-weight` of `bold`. + +```js +const fourthElement = document.querySelectorAll('div')?.[1]?.id; + +const style = new __helpers.CSSHelp(document).getStyle(`#${fourthElement}`); + +assert(style?.fontWeight === 'bold'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + +Number 1 - I'm a class!
+Number 3 - I'm a class, but cooler!
+Number 5 - I'm a class!
+ + +``` + +```css + +``` + +# --solutions-- + +```html + + + + + + +Number 1 - I'm a class!
+Number 3 - I'm a class, but cooler!
+Number 5 - I'm a class!
+ + +``` + +```css +.odd { + background-color: rgb(255, 167, 167); + font-family: Verdana, "DejaVu Sans", sans-serif; +} + +.adjust-font-size { + font-size: 24px; +} + +#two { + color: #0000ff; + font-size: 36px; +} + +#four { + background-color: red; + font-weight: bold; +} +``` diff --git a/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-c.md b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-c.md new file mode 100644 index 00000000000..5e19da6765e --- /dev/null +++ b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-c.md @@ -0,0 +1,44 @@ +--- +id: 63ee3fe9381756f9716727f1 +title: CSS Foundations Exercise C +challengeType: 14 +dashedName: css-foundations-exercise-c +--- + +# --description-- + +description + +# --hints-- + +Test 1 + +```js + +``` + +Test 2 + +```js + +``` + +Test 3 + +```js + +``` + + +# --seed-- + +## --seed-contents-- + +```html + +``` + +# --solutions-- + +```html +``` diff --git a/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-d.md b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-d.md new file mode 100644 index 00000000000..e5994dacba8 --- /dev/null +++ b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-d.md @@ -0,0 +1,44 @@ +--- +id: 63ee3ff1381756f9716727f2 +title: CSS Foundations Exercise D +challengeType: 14 +dashedName: css-foundations-exercise-d +--- + +# --description-- + +description + +# --hints-- + +Test 1 + +```js + +``` + +Test 2 + +```js + +``` + +Test 3 + +```js + +``` + + +# --seed-- + +## --seed-contents-- + +```html + +``` + +# --solutions-- + +```html +``` diff --git a/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-e.md b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-e.md new file mode 100644 index 00000000000..0fef651b9a7 --- /dev/null +++ b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-e.md @@ -0,0 +1,44 @@ +--- +id: 63ee3ff8381756f9716727f3 +title: CSS Foundations Exercise E +challengeType: 14 +dashedName: css-foundations-exercise-e +--- + +# --description-- + +description + +# --hints-- + +Test 1 + +```js + +``` + +Test 2 + +```js + +``` + +Test 3 + +```js + +``` + + +# --seed-- + +## --seed-contents-- + +```html + +``` + +# --solutions-- + +```html +``` diff --git a/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations/css-foundations-question-a.md b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations/css-foundations-question-a.md new file mode 100644 index 00000000000..b55a7cef82f --- /dev/null +++ b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations/css-foundations-question-a.md @@ -0,0 +1,52 @@ +--- +id: 63ee351d0d8d4841c3a7091a +videoId: LGQuIIv2RVA +title: CSS Foundations Question A +challengeType: 15 +dashedName: css-foundations-question-a +--- +# --description-- + +A type selector (or element selector) will select all elements of the given element type, and the syntax is just the name of the element: + +```html + + +Hi...
+` element wouldn’t be. + +# --question-- + +## --text-- + +Which of the following best describes the CSS code given above? + +## --answers-- + +The code applies a `white` color to all elements in the HTML file. + +--- + +The code applies a `white` color to all `div` elements in the HTML file. + +--- + +The code applies a `white` color to all `p` elements in the HTML file. + + +## --video-solution-- + +2 diff --git a/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations/css-foundations-question-b.md b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations/css-foundations-question-b.md new file mode 100644 index 00000000000..2c18fa42dcf --- /dev/null +++ b/curriculum/challenges/english/16-the-odin-project/top-learn-css-foundations/css-foundations-question-b.md @@ -0,0 +1,74 @@ +--- +id: 63ee35240d8d4841c3a7091b +videoId: LGQuIIv2RVA +title: CSS Foundations Question B +challengeType: 15 +dashedName: css-foundations-question-b +--- +# --description-- + +Class selectors will select all elements with the given `class`, which is just an attribute you place on an HTML element. Here’s how you add a class to an HTML tag and select it in CSS: + +```html + + +
This is where a preview for a post might go.
+This is where a preview for a post might go.
+