diff --git a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md index cdd62359751..74d2c335c12 100644 --- a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md +++ b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md @@ -1,6 +1,6 @@ --- id: 587d78af367417b2b2512b04 -title: Build a Product Landing Page +title: 製作一個產品登錄頁 challengeType: 14 forumTopicId: 301144 dashedName: build-a-product-landing-page @@ -8,87 +8,87 @@ dashedName: build-a-product-landing-page # --description-- -**Objective:** Build an app that is functionally similar to https://product-landing-page.freecodecamp.rocks +**目標:** 構建一個功能類似於 https://product-landing-page.freecodecamp.rocks 的應用程序 -**User Stories:** +**需求:** -1. Your product landing page should have a `header` element with a corresponding `id="header"` -1. You can see an image within the `header` element with a corresponding `id="header-img"` (A logo would make a good image here) -1. Within the `#header` element, you can see a `nav` element with a corresponding `id="nav-bar"` -1. You can see at least three clickable elements inside the `nav` element, each with the class `nav-link` -1. When you click a `.nav-link` button in the `nav` element, you are taken to the corresponding section of the landing page -1. You can watch an embedded product video with `id="video"` -1. Your landing page has a `form` element with a corresponding `id="form"` -1. Within the form, there is an `input` field with `id="email"` where you can enter an email address -1. The `#email` input field should have placeholder text to let users know what the field is for -1. The `#email` input field uses HTML5 validation to confirm that the entered text is an email address -1. Within the form, there is a submit `input` with a corresponding `id="submit"` -1. When you click the `#submit` element, the email is submitted to a static page (use this mock URL: `https://www.freecodecamp.com/email-submit`) -1. The navbar should always be at the top of the viewport -1. Your product landing page should have at least one media query -1. Your product landing page should utilize CSS flexbox at least once +1. 你的產品登錄頁應該有一個 `id="header"` 的 `header` 元素 +1. 你可以在 `header` 元素中看到一個 `id="header-img"` 的圖像(比如一個 logo) +1. 在 `#header` 元素中,你可以看到一個 `id="nav-bar"` 的 `nav` 元素 +1. 在 `nav` 元素中,你可以看到至少三個可點擊的元素,每個元素的 class 爲 `nav-link` +1. 當你點擊 `nav` 內的 `.nav-link` 按鈕時,應滾動到登錄頁相應的部分 +1. 你可以觀看一個 `id="video"` 的嵌入的產品視頻 +1. 你的登錄頁有一個 `id="form"` 的 `form` 元素 +1. 在表單中,應存在一個 `id="email"` 的 `input` 輸入框供用戶填寫郵箱地址 +1. 在 `#email` 輸入框內應有描述該區域用途的佔位符文本 +1. `#email` 輸入框應該用 HTML5 驗證來確認輸入的內容是否爲郵箱地址 +1. 在表單中,有一個 `id="submit"` 的 `input` 提交按鈕 +1. 當你點擊 `#submit` 元素時,郵箱會被提交到一個靜態頁面 (使用這個模擬 URL:`https://www.freecodecamp.com/email-submit`) +1. 導航欄應該始終位於視口的頂部 +1. 你的產品登陸頁面至少要有一個媒體查詢 +1. 你的產品登陸頁面應該至少使用一次 CSS flexbox -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +完成需求並通過下面的所有測試來完成這個項目。 賦予它你自己的個人風格。 編程愉快! # --hints-- -You should have a `header` element with an `id` of `header` +你應該有一個 `id` 爲 `header` 的 `header` 元素 ```js const el = document.getElementById('header') assert(!!el && el.tagName === 'HEADER') ``` -You should have an `img` element with an `id` of `header-img` +你應該有一個 `id` 爲 `header-img` 的 `img` 元素 ```js const el = document.getElementById('header-img') assert(!!el && el.tagName === 'IMG') ``` -Your `#header-img` should be a descendant of the `#header` +你的 `#header-img` 元素應該是 `#header` 元素的子元素 ```js const els = document.querySelectorAll('#header #header-img') assert(els.length > 0) ``` -Your `#header-img` should have a `src` attribute +你的 `#header-img` 元素應該有一個 `src` 屬性 ```js const el = document.getElementById('header-img') assert(!!el && !!el.src) ``` -Your `#header-img`’s `src` value should be a valid URL (starts with `http`) +你的 `#header-img` 元素的 `src` 屬性應該有一個有效的 URL(以 `http` 開頭) ```js const el = document.getElementById('header-img') assert(!!el && /^http/.test(el.src)) ``` -You should have a `nav` element with an `id` of `nav-bar` +你應該有一個 `id` 爲 `nav-bar` 的 `nav` 元素 ```js const el = document.getElementById('nav-bar') assert(!!el && el.tagName === 'NAV') ``` -Your `#nav-bar` should be a descendant of the `#header` +你的 `#nav-bar` 元素應該是 `#header` 元素的子元素 ```js const els = document.querySelectorAll('#header #nav-bar') assert(els.length > 0) ``` -You should have at least 3 `.nav-link` elements within the `#nav-bar` +在 `#nav-bar` 內,你應該有至少三個 `.nav-link` 元素 ```js const els = document.querySelectorAll('#nav-bar .nav-link') assert(els.length >= 3) ``` -Each `.nav-link` element should have an `href` attribute +每個 `.nav-link` 元素應該有一個 `href` 元素 ```js const els = document.querySelectorAll('.nav-link') @@ -98,7 +98,7 @@ els.forEach(el => { assert(els.length > 0) ``` -Each `.nav-link` element should link to a corresponding element on the landing page (has an `href` with a value of another element's id. e.g. `#footer`) +每一個 `.nav-link` 元素應該鏈接到登陸頁面上的相應元素(有一個 `href` 具有另一個元素的 id 的值,例如: `#footer`) ```js const els = document.querySelectorAll('.nav-link') @@ -109,91 +109,99 @@ els.forEach(el => { assert(els.length > 0) ``` -You should have a `video` or `iframe` element with an `id` of `video` +你應該有一個 `id` 爲 `video` 的 `video` 或 `iframe` 元素 ```js const el = document.getElementById('video') assert(!!el && (el.tagName === 'VIDEO' || el.tagName === 'IFRAME')) ``` -Your `#video` should have a `src` attribute +你的 `#video` 元素應該有一個 `src` 屬性 ```js -const el = document.getElementById('video') -assert(!!el && !!el.src) +let el = document.getElementById('video') +const sourceNode = el.children; +let sourceElement = null; +if (sourceNode.length) { + sourceElement = [...video.children].filter(el => el.localName === 'source')[0]; +} +if (sourceElement) { + el = sourceElement; +} +assert(el.hasAttribute('src')); ``` -You should have a `form` element with an `id` of `form` +你應該有一個 `id` 爲 `form` 的 `form` 元素 ```js const el = document.getElementById('form') assert(!!el && el.tagName === 'FORM') ``` -You should have an `input` element with an `id of `email` +你應該有一個 `id` 爲 `email` 的 `input` 元素 ```js const el = document.getElementById('email') assert(!!el && el.tagName === 'INPUT') ``` -Your `#email` should be a descendant of the `#form` +你的 `#email` 元素應該是 `#form` 元素的子元素 ```js const els = document.querySelectorAll('#form #email') assert(els.length > 0) ``` -Your `#email` should have the `placeholder` attribute with placeholder text +你的 `#email` 元素應該有 `placeholder` 屬性與佔位符文本 ```js const el = document.getElementById('email') assert(!!el && !!el.placeholder && el.placeholder.length > 0) ``` -Your `#email` should use HTML5 validation by setting its `type` to `email` +你的 `#email` 元素應該使用 HTML5 驗證,方法是設置 `type` 爲 `email` ```js const el = document.getElementById('email') assert(!!el && el.type === 'email') ``` -You should have an `input` element with an `id` of `submit` +你應該有一個 `id` 爲 `submit` 的 `input` 元素 ```js const el = document.getElementById('submit') assert(!!el && el.tagName === 'INPUT') ``` -Your `#submit` should be a descendant of the `#form` +你的 `#submit` 元素應該是 `#form` 元素的子元素 ```js const els = document.querySelectorAll('#form #submit') assert(els.length > 0) ``` -Your `#submit` should have a `type` of `submit` +你的 `#submit` 元素應該具有 `type` 爲 `submit` ```js const el = document.getElementById('submit') assert(!!el && el.type === 'submit') ``` -Your `#form` should have an `action` attribute of `https://www.freecodecamp.com/email-submit` +你的 `#form` 元素應該有值爲 `https://www.freecodecamp.com/email-submit` 的 `action` 屬性 ```js const el = document.getElementById('form') assert(!!el && el.action === 'https://www.freecodecamp.com/email-submit') ``` -Your `#email` should have a `name` attribute of `email` +你的 `#email` 元素應該具有值爲 `email` 的 `name` 屬性 ```js const el = document.getElementById('email') assert(!!el && el.name === 'email') ``` -Your `#nav-bar` should always be at the top of the viewport +你的 `#nav-bar` 元素應該始終位於視口的頂部 ```js const el = document.getElementById('nav-bar') @@ -202,13 +210,15 @@ const top2 = el?.offsetTop assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) ``` -Your Product Landing Page should use at least one media query +你的產品登陸頁面至少要有一個媒體查詢 ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` -Your Product Landing Page should use CSS Flexbox at least once +你的產品登陸頁面應該至少使用一次 CSS Flexbox ```js const stylesheet = new __helpers.CSSHelp(document).getStyleSheet() diff --git a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md index 178881da2ab..872e8a4192f 100644 --- a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md +++ b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md @@ -222,7 +222,9 @@ assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) 你的技術文檔項目應該使用至少一個媒體查詢。 ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md index 231292b4373..4a5b3a5ed48 100644 --- a/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md +++ b/curriculum/challenges/chinese-traditional/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md @@ -1,6 +1,6 @@ --- id: bd7158d8c442eddfaeb5bd18 -title: Build a Tribute Page +title: 製作一個致敬頁 challengeType: 14 forumTopicId: 301147 dashedName: build-a-tribute-page @@ -8,32 +8,32 @@ dashedName: build-a-tribute-page # --description-- -**Objective:** Build an app that is functionally similar to https://tribute-page.freecodecamp.rocks +**目標:** 構建一個功能類似於 https://tribute-page.freecodecamp.rocks 的應用程序 -**User Stories:** +**需求:** -1. Your tribute page should have an element with a corresponding `id="main"`, which contains all other elements -1. You should see an element with an `id` of `title`, which contains a string (i.e. text), that describes the subject of the tribute page (e.g. "Dr. Norman Borlaug") -1. You should see either a `figure` or a `div` element with an `id` of `img-div` -1. Within the `img-div` element, you should see an `img` element with a corresponding `id="image"` -1. Within the `img-div` element, you should see an element with a corresponding `id="img-caption"` that contains textual content describing the image shown in `img-div` -1. You should see an element with a corresponding `id="tribute-info"`, which contains textual content describing the subject of the tribute page -1. You should see an a element with a corresponding `id="tribute-link"`, which links to an outside site, that contains additional information about the subject of the tribute page. HINT: You must give your element an attribute of `target` and set it to `_blank` in order for your link to open in a new tab -1. Your `#image` should use `max-width` and `height` properties to resize responsively, relative to the width of its parent element, without exceeding its original size -1. Your `img` element should be centered within its parent element +1. 你的致敬頁面應該有一個 `id="main"` 的元素,該元素包含所有其他元素 +1. 你應該會看到一個 `id` 爲 `title` 的元素,其中包含一個字符串(即文本),描述了致敬頁面的主題(例如 “Dr. Norman Borlaug”) +1. 你應該有一個 `id` 爲 `img-div` 的 `figure` 或 `div` 元素 +1. 在 `img-div` 元素中,你應該看到一個 `id="image"` 的 `img` 元素 +1. 在`img-div`元素內,你應該看到一個 `id="img-caption"` 的元素,其中包含對 `img-div` 中圖像的文本描述 +1. 你應該看到一個 `id="tribute-info"` 的元素,其中包含描述致敬頁主題的文本內容 +1. 你應該看到一個 `id="tribute-link"` 的元素,它鏈接到一個包含有關致敬頁主題額外信息的外部網頁。 提示:你必須爲元素提供 `target` 屬性,並設置其爲 `_blank`,以便可以在新選項卡中打開鏈接。 +1. 你的 `#image` 應該使用 `max-width` 和 `height` 屬性來響應式調整大小,相對於其父元素的寬度,但不超過其原始大小 +1. 你的 `img` 元素應該在其父元素內居中 -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +完成需求並通過下面的所有測試來完成這個項目。 賦予它你自己的個人風格。 編程愉快! # --hints-- -You should have a `main` element with an `id` of `main` +你的頁面應該包含一個 `main` 元素,且它有一個值爲`main` 的`id`屬性。 ```js const el = document.getElementById('main') assert(!!el && el.tagName === 'MAIN') ``` -Your `#img-div`, `#image`, `#img-caption`, `#tribute-info`, and `#tribute-link` should all be descendants of `#main` +你的 `#img-div`、`#image`、`#img-caption`、`#tribute-info` 和 `#tribute-link` 應該是 `#main` 的子元素。 ```js const el1 = document.querySelector('#main #img-div') @@ -44,14 +44,14 @@ const el5 = document.querySelector('#main #tribute-link') assert(!!el1 & !!el2 && !!el3 && !!el4 && !!el5) ``` -You should have an element with an `id` of `title` +你應該有一個 `id` 爲 `title` 的元素。 ```js const el = document.getElementById('title') assert(!!el) ``` -Your `#title` should not be empty +你的 `#title` 不應爲空。 ```js const el = document.getElementById('title') @@ -59,120 +59,116 @@ assert(!!el && el.innerText.length > 0) ``` -You should have a `figure` or `div` element with an `id` of `img-div` +你應該有一個 `id` 爲 `img-div` 的 `figure` 或 `div` 元素。 ```js const el = document.getElementById('img-div') assert(!!el && (el.tagName === 'DIV' || el.tagName === 'FIGURE')) ``` -You should have an `img` element with an `id` of `image` +你應該有一個 `id` 爲 `image` 的 `img` 元素。 ```js const el = document.getElementById('image') assert(!!el && el.tagName === 'IMG') ``` -Your `#image` should be a descendant of `#img-div` +你的 `#image` 元素應該是 `#img-div` 元素的子元素。 ```js const el = document.querySelector('#img-div #image') assert(!!el) ``` -You should have a `figcaption` or `div` element with an `id` of `img-caption` +你應該有一個 `id` 爲 `img-caption` 的 `figcaption` 或 `div` 元素。 ```js const el = document.getElementById('img-caption') assert(!!el && (el.tagName === 'DIV' || el.tagName === 'FIGCAPTION')) ``` -Your `#img-caption` should be a descendant of `#img-div` +你的 `#img-caption` 元素應該是 `#img-div` 元素的子元素。 ```js const el = document.querySelector('#img-div #img-caption') assert(!!el) ``` -Your `#img-caption` should not be empty +你的 `#img-caption` 不應爲空。 ```js const el = document.getElementById('img-caption') assert(!!el && el.innerText.length > 0) ``` -You should have an element with an `id` of `tribute-info` +你應該有一個 `id` 爲 `tribute-info` 的元素。 ```js const el = document.getElementById('tribute-info') assert(!!el) ``` -Your `#tribute-info` should not be empty +你的 `#tribute-info` 不應爲空。 ```js const el = document.getElementById('tribute-info') assert(!!el && el.innerText.length > 0) ``` -You should have an `a` element with an `id` of `tribute-link` +你應該有一個 `id` 爲 `tribute-link` 的 `a` 元素。 ```js const el = document.getElementById('tribute-link') assert(!!el && el.tagName === 'A') ``` -Your `#tribute-link` should have an `href` attribute and value +你的 `#tribute-link` 應該有一個 `href` 屬性和值。 ```js const el = document.getElementById('tribute-link') assert(!!el && !!el.href && el.href.length > 0) ``` -Your `#tribute-link` should have a `target` attribute set to `_blank` +你的 `#tribute-link` 元素應該有一個值爲 `_blank` 的 `target` 屬性。 ```js const el = document.getElementById('tribute-link') assert(!!el && el.target === '_blank') ``` -You should use an `#image` selector in your CSS to style the `#image` and pass the next three tests +你的 `img` 元素應該具有 `display` 值爲 `block`。 ```js -const style = new __helpers.CSSHelp(document).getStyle('#image') -assert(!!style) -``` - -Your `#image` should have a `display` of `block` - -```js -const style = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('display') +const img = document.getElementById('image'); +const imgStyle = window.getComputedStyle(img); +const style = imgStyle?.getPropertyValue('display') assert(style === 'block') ``` -Your `#image` should have a `max-width` of `100%` +你的 `#image` 元素應該具有 `max-width` 值爲 `100%`。 ```js -const style = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('max-width') +const img = document.getElementById('image'); +const imgStyle = window.getComputedStyle(img); +const style = imgStyle?.getPropertyValue('max-width') assert(style === '100%') ``` -Your `#image` should have a `height` of `auto` +你的 `#image` 元素應該具有 `height` 值爲 `auto`。 ```js // taken from the testable-projects repo const img = document.getElementById('image'); -const maxWidthValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('max-width') -const displayValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('display') -const oldDisplayValue = img?.style.getPropertyValue('display'); -const oldDisplayPriority = img?.style.getPropertyPriority('display'); +const imgStyle = window.getComputedStyle(img); +const oldDisplayValue = imgStyle.getPropertyValue('display'); +const oldDisplayPriority = imgStyle.getPropertyPriority('display'); img?.style.setProperty('display', 'none', 'important'); -const heightValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('height') +const heightValue = imgStyle?.getPropertyValue('height') img?.style.setProperty('display', oldDisplayValue, oldDisplayPriority); assert(heightValue === 'auto') ``` -Your `#image` should be centered within its parent +你的 `#image` 元素應該在其父元素內居中。 ```js // taken from the testable-projects repo diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md index 76164cd1b6b..2847754f9fb 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md @@ -8,7 +8,7 @@ dashedName: create-complex-multi-dimensional-arrays # --description-- -很好! 你現在已經學到很多關於數組的知識了, 但這些只是個開始。我們將在接下來的中挑戰中學到更多與數組相關的知識。 在繼續學習對象(Objects)之前,讓我們再花一點時間瞭解下更復雜的數組嵌套。 +很好! 你現在已經學到很多關於數組的知識了, 但這些只是個開始。我們將在接下來的中挑戰中學到更多與數組相關的知識。 但在繼續查看 對象 之前,讓我們再看一下,看看數組如何變得比我們在之前的挑戰中看到的更復雜一些。 數組的一個強大的特性是,它可以包含其他數組,甚至完全由其他數組組成。 在上一個挑戰中,我們已經接觸到了包含數組的數組,但它還算是比較簡單的。 數組中的數組還可以再包含其他數組,即可以嵌套任意多層數組。 通過這種方式,數組可以很快成爲非常複雜的數據結構,稱爲多維(multi-dimensional)數組,或嵌套(nested)數組。 請看如下的示例: diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 3210dfa7c1b..c335ff3ef23 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -17,19 +17,19 @@ dashedName: understanding-uninitialized-variables # --hints-- -`a` 應該被定義,並且值爲 `6`。 +應該定義變量 `a`,且它的值爲 `6`。 ```js assert(typeof a === 'number' && a === 6); ``` -`b` 應該被定義,並且值爲 `15`。 +應該定義變量 `b`,且它最終的值爲 `15`。 ```js assert(typeof b === 'number' && b === 15); ``` -`c` 的值不能包含 `undefined`,應該爲字符串 `I am a String!`。 +變量 `c` 的值不能包含 `undefined`,應該爲字符串 `I am a String!`。 ```js assert(!/undefined/.test(c) && c === 'I am a String!'); diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md new file mode 100644 index 00000000000..feed089188c --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md @@ -0,0 +1,279 @@ +--- +id: bd7158d8c242eddfaeb5bd13 +title: 製作一個個人作品集展示頁 +challengeType: 14 +forumTopicId: 301143 +dashedName: build-a-personal-portfolio-webpage +--- + +# --description-- + +**目標:** 構建一個功能類似於 https://personal-portfolio.freecodecamp.rocks 的應用程序 + +**需求:** + +1. 你的作品集應該有一個 `id` 爲 `welcome-section` 的歡迎部分 +1. 歡迎部分應該有一個包含文本的 `h1` 元素 +1. 你的作品集應該有一個 `id` 爲 `projects` 的項目部分 +1. 項目部分應該包含至少一個 `class` 爲 `project-tile` 的元素來保存項目 +1. 項目部分應該包含至少一個項目的鏈接 +1. 你的作品集應該有一個 id 爲 `navbar` 的導航欄 +1. 導航欄應該至少包含一個鏈接,你可以點擊它來導航到頁面的不同部分 +1. 你的作品集應該有一個 id 爲 `profile-link` 的鏈接,在新標籤中打開你的 GitHub 或 freeCodeCodeCamp 個人主頁 +1. 你的作品集應該至少有一個媒體查詢 +1. 歡迎部分的高度應該等於視口的高度 +1. 導航欄應該始終位於視口的頂部 + +完成需求並通過下面的所有測試來完成這個項目。 賦予它你自己的個人風格。 編程愉快! + +# --hints-- + +你的作品集應該有一個 `id` 爲 `welcome-section` 的歡迎部分。 + +```js +const el = document.getElementById('welcome-section') +assert(!!el); +``` + +你的 `#welcome-section` 元素應該包含一個 `h1` 元素。 + +```js +assert.isAbove( + document.querySelectorAll('#welcome-section h1').length, + 0, + 'Welcome section should contain an h1 element ' +); +``` + +在 `#welcome-section` 元素中,你不應該有任何空的 `h1` 元素。 + +```js +assert.isAbove( + document.querySelectorAll('#welcome-section h1')?.[0]?.innerText?.length, + 0, + 'h1 element in welcome section should contain your name or camper ' + + 'name ' +); +``` + +你應該有一個 `id` 爲 `projects` 的項目部分。 + +```js +const el = document.getElementById('projects') +assert(!!el); +``` + +你的作品集應該包含至少一個 class 爲 `project-tile` 的元素。 + +```js +assert.isAbove( + document.querySelectorAll('#projects .project-tile').length, + 0 +); +``` + +你的 `#projects` 元素應該包含至少一個 `a` 元素。 + +```js +assert.isAbove(document.querySelectorAll('#projects a').length, 0); +``` + +你的作品集應該有一個 `id` 爲 `navbar` 的導航欄。 + +```js +const el = document.getElementById('navbar'); +assert(!!el); +``` + +你的 `#navbar` 元素應該包含至少一個 `a` 元素,它的 `href` 屬性以 `#` 開頭。 + +```js +const links = [...document.querySelectorAll('#navbar a')].filter( + (nav) => (nav?.getAttribute('href') || '').substr(0, 1) === '#' +); + +assert.isAbove( + links.length, + 0, + 'Navbar should contain an anchor link ' +); +``` + +你的作品集應該有一個 `id` 爲 `profile-link` 的 `a` 元素。 + +```js +const el = document.getElementById('profile-link'); +assert(!!el && el.tagName === 'A') +``` + +你的 `#profile-link` 元素應該有一個值爲 `_blank` 的 `target` 屬性。 + +```js +const el = document.getElementById('profile-link'); +assert(!!el && el.target === '_blank') +``` + +你的作品集應該至少有一個媒體查詢。 + +```js +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); +``` + +你的 `#navbar` 元素應該始終位於視口的頂部。 + +```js +(async () => { + const timeout = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)); + + const navbar = document.getElementById('navbar'); + assert.approximately( + navbar?.getBoundingClientRect().top, + 0, + 15, + "Navbar's parent should be body and it should be at the top of " + + 'the viewport ' + ); + + window.scroll(0, 500); + + await timeout(1); + + assert.approximately( + navbar?.getBoundingClientRect().top, + 0, + 15, + 'Navbar should be at the top of the viewport even after ' + + 'scrolling ' + ); + window.scroll(0, 0); +})(); +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Personal Portfolio + + + + + +
+
+
+

It's me!

+ +

Naomi Carrigan

+

Welcome to my portfolio page!

+

+
+

Projects

+

Here's what I've worked on!

+

+ + + + +


+
+

Contact me!

+

Use the links below to get in touch.

+

FreeCodeCamp.org | GitHub | Facebook | LinkedIn +

+ + + +``` + +```css +nav{ + position: fixed; + width: 100%; + text-align: right; + font-size: 24pt; + top: 0%; + right: 5px; + background-color: #000000; + color: #ffffff; +} +@media (max-width: 500px){ + nav{ + display: none; + } +} +a{ + color: #ffffff; +} +main{ + text-align: center; + background-color: black; + font-family:Pacifico +} +h1{ + font-size: 48pt; +} +h2{ + font-size: 24pt; +} +p{ + font-size: 12pt; +} +#welcome-section{ + background-color:#251a4a; + color: #FFFFFF; + display: table-cell; + vertical-align: middle; + width: 100vw; + height: 100vh; +} +#projects{ + background-color: #060a9c; + color: #ffffff; + display: table-cell; + vertical-align: middle; + width: 100vw; + height: 100vh; +} +#contact{ + background-color: #03300b; + color: #ffffff; + display: table-cell; + vertical-align: middle; + width: 100vw; + height: 100vh; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md new file mode 100644 index 00000000000..6bedb2a6e9f --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md @@ -0,0 +1,434 @@ +--- +id: 587d78af367417b2b2512b04 +title: 製作一個產品登錄頁 +challengeType: 14 +forumTopicId: 301144 +dashedName: build-a-product-landing-page +--- + +# --description-- + +**目標:** 構建一個功能類似於 https://product-landing-page.freecodecamp.rocks 的應用程序 + +**需求:** + +1. 你的產品登錄頁應該有一個 `id="header"` 的 `header` 元素 +1. 你可以在 `header` 元素中看到一個 `id="header-img"` 的圖像(比如一個 logo) +1. 在 `#header` 元素中,你可以看到一個 `id="nav-bar"` 的 `nav` 元素 +1. 在 `nav` 元素中,你可以看到至少三個可點擊的元素,每個元素的 class 爲 `nav-link` +1. 當你點擊 `nav` 內的 `.nav-link` 按鈕時,應滾動到登錄頁相應的部分 +1. 你可以觀看一個 `id="video"` 的嵌入的產品視頻 +1. 你的登錄頁有一個 `id="form"` 的 `form` 元素 +1. 在表單中,應存在一個 `id="email"` 的 `input` 輸入框供用戶填寫郵箱地址 +1. 在 `#email` 輸入框內應有描述該區域用途的佔位符文本 +1. `#email` 輸入框應該用 HTML5 驗證來確認輸入的內容是否爲郵箱地址 +1. 在表單中,有一個 `id="submit"` 的 `input` 提交按鈕 +1. 當你點擊 `#submit` 元素時,郵箱會被提交到一個靜態頁面 (使用這個模擬 URL:`https://www.freecodecamp.com/email-submit`) +1. 導航欄應該始終位於視口的頂部 +1. 你的產品登陸頁面至少要有一個媒體查詢 +1. 你的產品登陸頁面應該至少使用一次 CSS flexbox + +完成需求並通過下面的所有測試來完成這個項目。 賦予它你自己的個人風格。 編程愉快! + +# --hints-- + +你應該有一個 `id` 爲 `header` 的 `header` 元素。 + +```js +const el = document.getElementById('header') +assert(!!el && el.tagName === 'HEADER') +``` + +你應該有一個 `id` 爲 `header-img` 的 `img` 元素。 + +```js +const el = document.getElementById('header-img') +assert(!!el && el.tagName === 'IMG') +``` + +你的 `#header-img` 元素應該是 `#header` 元素的子元素。 + +```js +const els = document.querySelectorAll('#header #header-img') +assert(els.length > 0) +``` + +你的 `#header-img` 元素應該有一個 `src` 屬性。 + +```js +const el = document.getElementById('header-img') +assert(!!el && !!el.src) +``` + +你的 `#header-img` 元素的 `src` 屬性應該有一個有效的 URL(以 `http` 開頭)。 + +```js +const el = document.getElementById('header-img') +assert(!!el && /^http/.test(el.src)) +``` + +你應該有一個 `id` 爲 `nav-bar` 的 `nav` 元素。 + +```js +const el = document.getElementById('nav-bar') +assert(!!el && el.tagName === 'NAV') +``` + +你的 `#nav-bar` 元素應該是 `#header` 元素的子元素。 + +```js +const els = document.querySelectorAll('#header #nav-bar') +assert(els.length > 0) +``` + +在 `#nav-bar` 內,你應該有至少三個 `.nav-link` 元素。 + +```js +const els = document.querySelectorAll('#nav-bar .nav-link') +assert(els.length >= 3) +``` + +每個 `.nav-link` 元素應該有一個 `href` 元素。 + +```js +const els = document.querySelectorAll('.nav-link') +els.forEach(el => { + if (!el.href) assert(false) +}) +assert(els.length > 0) +``` + +每個 `.nav-link` 元素應該鏈接到登陸頁面上的相應元素(有一個 `href` 具有另一個元素的 id 的值,例如: `#footer`)。 + +```js +const els = document.querySelectorAll('.nav-link') +els.forEach(el => { + const linkDestination = el.getAttribute('href').slice(1) + if (!document.getElementById(linkDestination)) assert(false) +}) +assert(els.length > 0) +``` + +你應該有一個 `id` 爲 `video` 的 `video` 或 `iframe` 元素。 + +```js +const el = document.getElementById('video') +assert(!!el && (el.tagName === 'VIDEO' || el.tagName === 'IFRAME')) +``` + +你的 `#video` 元素應該有一個 `src` 屬性。 + +```js +let el = document.getElementById('video') +const sourceNode = el.children; +let sourceElement = null; +if (sourceNode.length) { + sourceElement = [...video.children].filter(el => el.localName === 'source')[0]; +} +if (sourceElement) { + el = sourceElement; +} +assert(el.hasAttribute('src')); +``` + +你應該有一個 `id` 爲 `form` 的 `form` 元素。 + +```js +const el = document.getElementById('form') +assert(!!el && el.tagName === 'FORM') +``` + +你應該有一個 `id` 爲 `email` 的 `input` 元素。 + +```js +const el = document.getElementById('email') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#email` 元素應該是 `#form` 元素的子元素。 + +```js +const els = document.querySelectorAll('#form #email') +assert(els.length > 0) +``` + +你的 `#email` 元素應該有 `placeholder` 屬性與佔位符文本。 + +```js +const el = document.getElementById('email') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你的 `#email` 元素應該使用 HTML5 驗證,方法是設置 `type` 爲 `email`。 + +```js +const el = document.getElementById('email') +assert(!!el && el.type === 'email') +``` + +你應該有一個 `id` 爲 `submit` 的 `input` 元素。 + +```js +const el = document.getElementById('submit') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#submit` 元素應該是 `#form` 元素的子元素。 + +```js +const els = document.querySelectorAll('#form #submit') +assert(els.length > 0) +``` + +你的 `#submit` 元素應該具有 `type` 爲 `submit`。 + +```js +const el = document.getElementById('submit') +assert(!!el && el.type === 'submit') +``` + +你的 `#form` 元素應該有值爲 `https://www.freecodecamp.com/email-submit` 的 `action` 屬性。 + +```js +const el = document.getElementById('form') +assert(!!el && el.action === 'https://www.freecodecamp.com/email-submit') +``` + +你的 `#email` 元素應該具有值爲 `email` 的 `name` 屬性。 + +```js +const el = document.getElementById('email') +assert(!!el && el.name === 'email') +``` + +你的 `#nav-bar` 元素應該始終位於視口的頂部。 + +```js +const el = document.getElementById('nav-bar') +const top1 = el?.offsetTop +const top2 = el?.offsetTop +assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) +``` + +你的產品登陸頁面至少要有一個媒體查詢。 + +```js +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); +``` + +你的產品登陸頁面應該至少使用一次 CSS Flexbox。 + +```js +const stylesheet = new __helpers.CSSHelp(document).getStyleSheet() +const cssRules = new __helpers.CSSHelp(document).styleSheetToCssRulesArray(stylesheet) +const usesFlex = cssRules.find(rule => { + return rule.style?.display === 'flex' || rule.style?.display === 'inline-flex' +}) +assert(usesFlex) +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Product Landing Page + + + +
+

+ Pokemon Daycare Service +

+
+

What we offer

+
+
+ +
+
Guaranteed friendly and loving staff!
+
+
+
+ +
+
+ Comfortable environment for Pokemon to explore and play! +
+
+
+
+ +
+
+ Multiple membership plans to fit your lifestyle! +
+
+
+
+

Check us out!

+ A sneak peek into our facility: +
+ +
+
+

Membership Plans

+
+
+ Basic Membership
+
    +
  • One Pokemon
  • +
  • Food and berries provided
  • +
+ $9.99/month +
+
+ Silver Membership
+
    +
  • Up to Three Pokemon
  • +
  • Food and berries provided
  • +
  • Grooming and accessories included
  • +
+ $19.99/month +
+
+ Gold Membership
+
    +
  • Up to six Pokemon!
  • +
  • Food and berries provided
  • +
  • Grooming and accessories included
  • +
  • Personal training for each Pokemon
  • +
  • Breeding and egg hatching
  • +
+ $29.99/month +
+
+
+
+

Sign up for our newsletter!

+ + +
+ +
+ + +``` + +```css +body { + background-color: #3a3240; + color: white; +} +main { + max-width: 750px; + margin: 50px auto; +} +input { + background-color: #92869c; +} +a:not(.nav-link) { + color: white; +} +#header-img { + max-height: 25px; +} +#nav-bar { + position: fixed; + width: 100%; + text-align: center; + top: 0%; + background-color: #92869c; +} +h1 { + text-align: center; +} +body { + text-align: center; +} +footer { + text-align: center; +} +#bullet { + max-height: 25px; +} +.flex-here { + display: flex; + justify-content: center; +} +.flex-left { + height: 25px; +} +.flex-mem { + display: flex; + justify-content: center; +} +.flex-mem-box { + background-color: #92869c; + border-color: black; + border-width: 5px; + border-style: solid; + margin: 10px; + padding: 10px; + color: black; +} +@media (max-width: 350px) { + #video { + width: 300; + height: 200; + } +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-survey-form-project/build-a-survey-form.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-survey-form-project/build-a-survey-form.md new file mode 100644 index 00000000000..09d708c427e --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-survey-form-project/build-a-survey-form.md @@ -0,0 +1,516 @@ +--- +id: 587d78af367417b2b2512b03 +title: 製作一個調查表格 +challengeType: 14 +forumTopicId: 301145 +dashedName: build-a-survey-form +--- + +# --description-- + +**目標:** 構建一個功能類似於 https://survey-form.freecodecamp.rocks 的應用程序 + +**需求:** + +1. 你應該有一個 `id` 爲 `title` 的 `h1` 元素 +1. 你應該有一個 `id` 爲 `description` 的 `p` 元素 +1. 你應該有一個 `id` 爲 `survey-form` 的 `form` 元素 +1. 在表單元素內,你**需要**在 `input` 字段中輸入你的名字,該字段的 `id` 爲 `name`,`type` 爲 `text` +1. 在表單元素內,你**需要**在 `input` 字段中輸入你的郵箱,該字段的 `id` 爲 `email` +1. 如果你輸入了格式不正確的郵箱,你將會看見 HTML5 驗證錯誤信息 +1. 在表單中,你可以在 `input` 字段中輸入一個數字,該字段的 `id` 爲 `number` +1. 如果你在數字輸入框內輸入非數字內容,你會看到 HTML5 驗證錯誤信息 +1. 如果你輸入的數字超出了範圍(使用 `min` 和 `max` 屬性定義),你將會看見 HTML5 驗證錯誤信息 +1. 表單中的名字、郵箱和數字輸入框需有對應的包含描述輸入框用途的 `label` 元素,id 應分別爲 `id="name-label"`、`id="email-label"` 和 `id="number-label"` +1. 在表單中的名字、郵箱和數字輸入框中,你能看到各自的描述文字作爲佔位符 +1. 在表單元素內, 你應該有一個 `select` 下拉元素, `id` 爲 `dropdown`,它至少有兩個選項 +1. 在表單元素內, 你可以從至少兩個單選按鈕的組中選擇一個選項,該選項使用 `name` 屬性 +1. 在表單元素內,你可以從一系列複選框中選擇幾個字段,每個複選框都必須具有 `value` 屬性 +1. 在表單元素內,你會有一個 `textarea` 以獲取額外的評論 +1. 在表單元素內,你將收到一個按鈕,其 `id` 爲 `submit`,提交所有輸入 + +完成需求並通過下面的所有測試來完成這個項目。 賦予它你自己的個人風格。 編程愉快! + +# --hints-- + +你應該有一個 `id` 爲 `title` 的 `h1` 元素。 + +```js +const el = document.getElementById('title') +assert(!!el && el.tagName === 'H1') +``` + +你的 `#title` 不應爲空。 + +```js +const el = document.getElementById('title') +assert(!!el && el.innerText.length > 0) +``` + +你應該有一個 `id` 爲 `description` 的 `p` 元素。 + +```js +const el = document.getElementById('description') +assert(!!el && el.tagName === 'P') +``` + +你的 `#description` 不應爲空。 + +```js +const el = document.getElementById('description') +assert(!!el && el.innerText.length > 0) +``` + +你應該有一個 `id` 爲 `survey-form` 的 `form` 元素。 + +```js +const el = document.getElementById('survey-form') +assert(!!el && el.tagName === 'FORM') +``` + +你應該有一個 `id` 爲 `name` 的 `input` 元素。 + +```js +const el = document.getElementById('name') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#name` 元素應該具有 `type` 爲 `text`。 + +```js +const el = document.getElementById('name') +assert(!!el && el.type === 'text') +``` + +你的 `#name` 元素應該需要輸入。 + +```js +const el = document.getElementById('name') +assert(!!el && el.required) +``` + +你的 `#name` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #name') +assert(!!el) +``` + +你應該有一個 `id` 爲 `email` 的 `input` 元素。 + +```js +const el = document.getElementById('email') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#email` 元素應該具有 `type` 爲 `email`。 + +```js +const el = document.getElementById('email') +assert(!!el && el.type === 'email') +``` + +你的 `#email` 元素應該需要輸入。 + +```js +const el = document.getElementById('email') +assert(!!el && el.required) +``` + +你的 `#email` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #email') +assert(!!el) +``` + +你應該有一個 `id` 爲 `number` 的 `input` 元素。 + +```js +const el = document.getElementById('number') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#number` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #number') +assert(!!el) +``` + +你的 `#number` 元素應該具有 `type` 爲 `number`。 + +```js +const el = document.getElementById('number') +assert(!!el && el.type === 'number') +``` + +你的 `#number` 應該有一個值爲數字的 `min` 屬性。 + +```js +const el = document.getElementById('number') +assert(!!el && el.min && isFinite(el.min)) +``` + +你的 `#number` 應該有一個值爲數字的 `max` 屬性。 + +```js +const el = document.getElementById('number') +assert(!!el && el.max && isFinite(el.max)) +``` + +你應該有一個 `id` 爲 `name-label` 的 `label` 元素。 + +```js +const el = document.getElementById('name-label') +assert(!!el && el.tagName === 'LABEL') +``` + +你應該有一個 `id` 爲 `email-label` 的 `label` 元素。 + +```js +const el = document.getElementById('email-label') +assert(!!el && el.tagName === 'LABEL') +``` + +你應該有一個 `id` 爲 `number-label` 的 `label` 元素。 + +```js +const el = document.getElementById('number-label') +assert(!!el && el.tagName === 'LABEL') +``` + +你的 `#name-label` 不應爲空。 + +```js +const el = document.getElementById('name-label') +assert(!!el && el.innerText.length > 0) +``` + +你的 `#email-label` 不應爲空。 + +```js +const el = document.getElementById('email-label') +assert(!!el && el.innerText.length > 0) +``` + +你的 `#number-label` 不應爲空。 + +```js +const el = document.getElementById('number-label') +assert(!!el && el.innerText.length > 0) +``` + +你的 `#name-label` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #name-label') +assert(!!el) +``` + +你的 `#email-label` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #email-label') +assert(!!el) +``` + +你的 `#number-label` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #number-label') +assert(!!el) +``` + +你的 `#name` 元素應該有 `placeholder` 屬性與佔位符文本。 + +```js +const el = document.getElementById('name') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你的 `#email` 元素應該有 `placeholder` 屬性與佔位符文本。 + +```js +const el = document.getElementById('email') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你的 `#number` 元素應該有 `placeholder` 屬性與佔位符文本。 + +```js +const el = document.getElementById('number') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你應該有一個 `id` 爲 `dropdown` 的 `select` 元素。 + +```js +const el = document.getElementById('dropdown') +assert(!!el && el.tagName === 'SELECT') +``` + +你的 `#dropdown` 應該至少有兩個可選擇(未禁用)`option` 元素。 + +```js +const els = document.querySelectorAll('#dropdown option:not([disabled])') +assert(els.length >= 2) +``` + +你的 `#dropdown` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #dropdown') +assert(!!el) +``` + +你應該有至少兩個 `input` 元素,`type` 爲 `radio`(單選按鈕)。 + +```js +const els = document.querySelectorAll('input[type="radio"]') +assert(els.length >= 2) +``` + +你至少應該有兩個單選按鈕,是 `#survey-form` 的子元素。 + +```js +const els = document.querySelectorAll('#survey-form input[type="radio"]') +assert(els.length >= 2) +``` + +你所有的單選按鈕都應該有一個 `value` 屬性和值。 + +```js +const els1 = document.querySelectorAll('input[type="radio"]') +const els2 = document.querySelectorAll('input[type="radio"][value=""], input[type="radio"]:not([value])') +assert(els1.length > 0 && els2.length === 0) +``` + +你所有的單選按鈕都應該有一個 `name` 屬性和值。 + +```js +const els1 = document.querySelectorAll('input[type="radio"]') +const els2 = document.querySelectorAll('input[type="radio"][name=""], input[type="radio"]:not([name])') +assert(els1.length > 0 && els2.length === 0) +``` + +每個單選按鈕組應至少有 2 個單選按鈕。 + +```js +const radioButtons = document.querySelectorAll('input[type="radio"]'); +const groups = {} + +if (radioButtons) { + radioButtons.forEach(el => { + if (!groups[el.name]) groups[el.name] = [] + groups[el.name].push(el) + }) +} + +const groupKeys = Object.keys(groups) + +groupKeys.forEach(key => { + if (groups[key].length < 2) assert(false) +}) + +assert(groupKeys.length > 0) +``` + +你應該至少有兩個 `input` 元素,`type` 爲 `checkbox`(複選框),它們是 `#survey-form` 的子元素。 + +```js +const els = document.querySelectorAll('#survey-form input[type="checkbox"]'); +assert(els.length >= 2) +``` + +你在 `#survey-form` 中的所有複選框都應該有 `value` 屬性和值。 + +```js +const els1 = document.querySelectorAll('#survey-form input[type="checkbox"]') +const els2 = document.querySelectorAll('#survey-form input[type="checkbox"][value=""], #survey-form input[type="checkbox"]:not([value])') +assert(els1.length > 0 && els2.length === 0) +``` + +你至少應該有一個 `textarea` 元素,它是 `#survey-form` 的子元素。 + +```js +const el = document.querySelector('#survey-form textarea') +assert(!!el) +``` + +你應該有一個 `id` 爲 `submit` 的 `input` 或 `button` 元素。 + +```js +const el = document.getElementById('submit') +assert(!!el && (el.tagName === 'INPUT' || el.tagName === 'BUTTON')) +``` + +你的 `#submit` 元素應該具有 `type` 爲 `submit`。 + +```js +const el = document.getElementById('submit') +assert(!!el && el.type === 'submit') +``` + +你的 `#submit` 元素應該是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #submit') +assert(!!el) +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Survey Form + + +

Survey Form

+

The card below was built as a sample survey form for freeCodeCamp.

+
+

Join the Togepi Fan Club!

+

+ Enter your information here to receive updates about club activities, + our monthly newsletter, and other email communications. +

+
+ + + + +

Who is your favourite Pokemon?

+ + + +

Which communications do you want to receive?

+ + + +

Any other information you would like to share?

+ +

+ Please note: This form is a proof of concept. Submitting the form + will not actually transmit your data. +

+ +
+
+ + + +``` + +```css +main { + text-align: center; + background-color: #92869c; + background-blend-mode: lighten; + max-width: 500px; + margin: 20px auto; + border-radius: 50px; + box-shadow: 10px 10px rgba(0, 0, 0, 0.5); + color: black; +} +body { + text-align: center; + background: #3a3240; + color: white; +} +input, textarea, select, button { + background: #3a3240; + color: white; +} +a { + color: white; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md new file mode 100644 index 00000000000..0b7ba827ed4 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md @@ -0,0 +1,527 @@ +--- +id: 587d78b0367417b2b2512b05 +title: 製作一個技術文檔頁面 +challengeType: 14 +forumTopicId: 301146 +dashedName: build-a-technical-documentation-page +--- + +# --description-- + +**目標:** 構建一個功能類似於 https://technical-documentation-page.freecodecamp.rocks 的應用程序 + +**需求:** + +1. 你能看見一個 `id="main-doc"` 的 `main`元素,它包含頁面的主要內容(技術文檔)。 +1. 在 `#main-doc` 元素內,我能看見至少 5 個 `section` 元素,每個元素都有一個 class 爲 `main-section`。 應存在至少 5 個這樣的元素。 +1. 每個 `.main-section` 中的第一個元素應該是 `header` 元素,其中包含描述該部分主題的文本。 +1. class 爲 `main-section` 的每個 `section` 元素應該有一個與包含在其中的每個 `header` 的文本相對應的 `id`。 所有空格都應該被替換爲下劃線(例如,包含標題 “JavaScript and Java” 的 section 應有一個相應的 `id="JavaScript_and_Java"`)。 +1. 所有 `.main-section` 元素總計(不是每個)包含至少 10 個 `p` 元素。 +1. 所有 `.main-section` 元素總計(不是每個)包含至少 5 個 `code` 元素。 +1. 所有 `.main-section` 元素總計(不是每個)包含至少 5 個 `li` 元素。 +1. 你能看見一個 `id="navbar"` 的 `nav` 元素。 +1. navbar 元素應包含一個 `header` 元素,其中包含描述技術文檔主題的文本。 +1. 此外,導航欄應包含 class 爲 `nav-link` 的鏈接元素(`a`)。 每個 class 爲 `main-section` 的元素都需要有一個。 +1. `#navbar` 中的 `header` 元素必須在任何鏈接(`a`)之前。 +1. class 爲 `nav-link` 的每個元素都應該包含每個 `section` 的 `header` 文本對應的文本(例如,如果你有一個 “Hello world” 部分/標題,你的導航欄應該有一個包含文本 “Hello world” 的元素)。 +1. 當你點擊一個 navbar 元素時,頁面應該導航到 `#main-doc` 元素的相應部分(例如,如果你點擊包含文本 “Hello world” 的 `.nav-link` 元素,頁面將導航到一個帶有對應 header 和 id 的 `section` 元素)。 +1. 在常規尺寸的設備上(筆記本電腦、臺式機),帶有 `id="navbar"` 的元素應該顯示在屏幕左側,並且始終對用戶可見。 +1. 你的技術文檔應該使用至少一個媒體查詢。 + +完成需求並通過下面的所有測試來完成這個項目。 賦予它你自己的個人風格。 編程愉快! + +# --hints-- + +你應該有一個 `id` 爲 `main-doc` 的 `main` 元素。 + +```js +const el = document.getElementById('main-doc') +assert(!!el) +``` + +你至少應該有 5 個 class 爲 `main-section` 的 `section` 元素。 + +```js +const els = document.querySelectorAll('#main-doc section') +assert(els.length >= 5) +``` + +你所有的 `.main-section` 元素都應該是 `section` 元素。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + if (el.tagName !== 'SECTION') assert(false) +}) +assert(els.length > 0) +``` + +你至少應該有 5 個 `.main-section` 元素,它們是 `#main-doc` 的子元素。 + +```js +const els = document.querySelectorAll('#main-doc .main-section') +assert(els.length >= 5) +``` + +每個 `.main-section` 的第一個子元素都應該是一個 `header` 元素。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + if(el.firstElementChild?.tagName !== 'HEADER') assert(false) +}) +assert(els.length > 0) +``` + +你的 `header` 元素不應爲空。 + +```js +const els = document.querySelectorAll('header') +els.forEach(el => { + if (el.innerText?.length <= 0) assert(false) +}) +assert(els.length > 0) +``` + +你所有的 `.main-section` 元素都應該有 `id`。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + if (!el.id || el.id === '') assert(false) +}) +assert(els.length > 0) +``` + +每個 `.main-section` 都應該有一個與其第一個子元素的文本匹配的 `id`,把子元素的文本中的空格都替換爲下劃線(`_`)用於 id。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + const text = el.firstElementChild?.innerText?.replaceAll(' ', '_') + if (el.id?.toUpperCase() !== text?.toUpperCase()) assert(false) +}) +assert(els.length > 0) +``` + +在你的 `.main-section` 元素中總計應有至少 10 個 `p` 元素 + +```js +const els = document.querySelectorAll('.main-section p') +assert(els.length >= 10) +``` + +所有 `.main-section` 元素內總計應有至少 5 個 `code` 元素。 + +```js +const els = document.querySelectorAll('.main-section code') +assert(els.length >= 5) +``` + +所有 `.main-section` 元素內總計應有至少 5 個 `li` 元素。 + +```js +const els = document.querySelectorAll('.main-section li') +assert(els.length >= 5) +``` + +你應該有一個 `id` 爲 `navbar` 的 `nav` 元素。 + +```js +const el = document.getElementById('navbar') +assert(!!el && el.tagName === 'NAV') +``` + +你的 `#navbar` 應該只有一個 `header` 元素。 + +```js +const els = document.querySelectorAll('#navbar header') +assert(els.length === 1) +``` + +你應該至少有一個 class 爲 `nav-link` 的 `a` 元素。 + +```js +const els = document.querySelectorAll('a[class="nav-link"]') +assert(els.length >= 1) +``` + +你所有的 `.nav-link` 元素都應該是錨點(`a`)元素。 + +```js +const els = document.querySelectorAll('.nav-link') +els.forEach(el => { + if (el.tagName !== 'A') assert(false) +}) +assert(els.length > 0) +``` + +你所有的 `.nav-link` 元素都應該在 `#navbar` 中。 + +```js +const els1 = document.querySelectorAll('.nav-link') +const els2 = document.querySelectorAll('#navbar .nav-link') +assert(els2.length > 0 && els1.length === els2.length) +``` + +你應該有相同數量的 `.nav-link` 和 `.main-section` 元素。 + +```js +const els1 = document.querySelectorAll('.main-section') +const els2 = document.querySelectorAll('.nav-link') +assert(els1.length > 0 && els2.length > 0 && els1.length === els2.length) +``` + +`#navbar` 中的 `header` 元素必須在 `#navbar` 中的任何鏈接(`a`)之前。 + +```js +const navLinks = document.querySelectorAll('#navbar a.nav-link'); +const header = document.querySelector('#navbar header'); +navLinks.forEach((navLink) => { + if ( + ( + header.compareDocumentPosition(navLink) & + Node.DOCUMENT_POSITION_PRECEDING + ) + ) assert(false) +}); +assert(!!header) +``` + +每個 `.nav-link` 應該有與其相關 `section` 的 `header` 文本相對應的文本(例如,如果你有一個 “Hello world” 部分/標題,你的 `#navbar` 應該有一個 `.nav-link` 包含文本 “Hello world”)。 + +```js +const headerText = Array.from(document.querySelectorAll('.main-section')).map(el => + el.firstElementChild?.innerText?.trim().toUpperCase() +) +const linkText = Array.from(document.querySelectorAll('.nav-link')).map(el => + el.innerText?.trim().toUpperCase() +) +const remainder = headerText.filter(str => linkText.indexOf(str) === -1) +assert(headerText.length > 0 && headerText.length > 0 && remainder.length === 0) +``` + +每個 `.nav-link` 都應該有一個 `href` 屬性,該屬性鏈接到其對應的 `.main-section`(例如,如果你單擊包含文本 “Hello world” 的 `.nav-link` 元素,頁面導航到具有該 id 的 `section` 元素)。 + +```js +const hrefValues = Array.from(document.querySelectorAll('.nav-link')).map(el => el.getAttribute('href')) +const mainSectionIDs = Array.from(document.querySelectorAll('.main-section')).map(el => el.id) +const missingHrefValues = mainSectionIDs.filter(str => hrefValues.indexOf('#' + str) === -1) +assert(hrefValues.length > 0 && mainSectionIDs.length > 0 && missingHrefValues.length === 0) +``` + +你的 `#navbar` 元素應該始終位於視口的頂部。 + +```js +const el = document.getElementById('navbar') +const left1 = el?.offsetLeft +const left2 = el?.offsetLeft +assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) +``` + +你的技術文檔項目應該使用至少一個媒體查詢。 + +```js +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Technical Documentation Page + + + +
+
+
Introduction
+

+ Welcome to a basic introduction of algebra. In this tutorial, we will + review some of the more common algebraic concepts. +

+
+
+
Definitions
+

+ To start with, let's define some of the more common terms used in + algebra: +

+
    +
  • + Variable: A variable is an unknown value, usually represented + by a letter. +
  • +
  • + Expression: Essentially a mathematical object. For the + purpose of this tutorial, an expression is one part of an equation. +
  • +
  • + Equation: An equation is a mathematical argument in which two + expressions result in the same value. +
  • +
+
+
+
Examples
+

+ Sometimes it is easier to understand the definitions when you have a + physical example to look at. Here is an example of the above terms.

+ x + 5 = 12

+ In this above example, we have: +

+
    +
  • Variable: The variable in the example is "x".
  • +
  • + Expression: There are two expressions in this example. They + are "x+5" and "12". +
  • +
  • + Equation: The entire example, "x+5=12", is an equation. +
  • +
+
+
+
Solving Equations
+

+ The primary use for algebra is to determine an unknown value, the + "variable", with the information provided. Continuing to use our + example from above, we can find the value of the variable "x".

+ x + 5 = 12

+ In an equation, both sides result in the same value. So you can + manipulate the two expressions however you need, as long as you + perform the same operation (or change) to each side. You do this + because the goal when solving an equation is to + get the variable into its own expression, or by itself on one side + of the = sign.
For this example, we want to remove the "+5" so the "x" is + alone. To do this, we can subtract 5, because subtraction is + the opposite operation to addition. But remember, we have to perform + the same operation to both sides of the equation. Now our equation + looks like this.

+ x + 5 - 5 = 12 - 5

+ The equation looks like a mess right now, because we haven't completed + the operations. We can simplify this equation to make it easier + to read by performing the operations "5-5" and "12-5". The result + is:

+ x = 7

+ We now have our solution to this equation! +

+
+
+
Solving Equations II
+

+ Let us look at a slightly more challenging equation.

+ 3x + 4 = 13

+ Again we can start with subtraction. In this case, we want to subtract + 4 from each side of the equation. We will also go ahead and simplify + with each step. So now we have:

+ 3x = 9

+ "3x" translates to "3*x", where the "*" symbol indicates + multiplication. We use the "*" to avoid confusion, as the "x" is now a + variable instead of a multiplication symbol. The opposite operation + for multiplication is division, so we need to + divide each expression by 3.

+ x = 3

+ And now we have our solution! +

+
+
+
Solving Equations III
+

+ Now we are getting in to more complex operations. Here is another + equation for us to look at:

+ x^2 - 8 = 8

+ Our very first step will be to add 8 to each side. This is + different from our previous examples, where we had to subtract. But + remember, our goal is to get the variable alone by performing opposite + operations.

+ x^2 = 16

+ But what does the "^2" mean? The "^" symbol is used to denote + exponents in situations where superscript is not available. When + superscript is available, you would see it as x2. + For the sake of this project, however, we will use the "^" symbol.
+ An exponent tells you how many times the base (in our case, "x") is + multiplied by itself. So, "x^2" would be the same as "x*x". Now the + opposite function of multiplication is division, but we would have to + divide both sides by "x". We do not want to do this, as that + would put an "x" on the other side of the equation. So instead, we + need to use the root operation! For an exponent of "2", we call this + the "square root" and denote it with "√". Our equation is now: +

+ x = √9

+ Performing a root operation by hand can be a tedious process, so we + recommend using a calculator when necessary. However, we are lucky in + that "9" is a + perfect square, so we do not need to calculate anything. Instead, we find our + answer to be:

+ x = 3 +

+
+
+
System of Equations
+

+ As you explore your algebra studies further, you may start to run + across equations with more than one variable. The first such equations + will likely look like:

+ y = 3x

+ An equation like this does not have one single solution. + Rather, there are a series of values for which the equation is true. + For example, if "x=3" and "y=9", the equation is true. These equations + are usually used to plot a graph.
+ Getting more complicated, though, you may be given a pair of + equations. This is called a "system of equations", and CAN be solved. + Let's look at how we do this! Consider the following system of + equations:

+ y = 3x | y - 6 = x + A system of equations IS solvable, but it is a multi-step process. To + get started, we need to chose a variable we are solving for. Let's + solve for "x" first. From the second equation, we know that "x" equals + "y - 6", but we cannot simplify that further because we do not have a + value for "y". Except, thanks to the system of equations, we DO have a + value for "y". We know that "y" equals "3x". So, looking at our second + equation, we can replace "y" with "3x" because they have the same + value. We then get:

+ 3x - 6 = x

+ Now we can solve for "x"! We start by adding 6 to each side.

+ 3x = x + 6

+ We still need to get "x" by itself, so we subtract "x" from both sides + and get:

+ 2x = 6

+ If this confuses you, remember that "3x" is the same as "x+x+x". + Subtract an "x" from that and you get "x+x", or "2x". Now we divide + both sides by 2 and have our value for x!

+ x = 3

+ However, our work is not done yet. We still need to find the value for + "y". Let's go back to our first equation:

+ y = 3x

+ We have a value for "x" now, so let's see what happens if we put that + value in.

+ y = 3*3

+ We perform the multiplication and discover that "y=9"! Our solution to + this system of equations then is:

+ x = 3 and y = 9

+

+
+
+
Try it Yourself!
+

Coming Soon!

+

Keep an eye out for new additions!

+
+
+
More Information
+

Check out the following links for more information!

+ +
+
+ + + +``` + +```css +* { + background-color: #3a3240; +} +a { + color: #92869c; +} +a:hover { + background-color: #92869c; + color: #3a3240; +} +#navbar { + border-style: solid; + border-width: 5px; + border-color: #92869c; + height: 100%; + top: -5px; + left: -5px; + padding: 5px; + text-align: center; + color: #92869c +} +@media (min-width: 480px) { + #navbar { + position: fixed; + } +} +main { + margin-left: 220px; + color: #92869c +} +header { + font-size: 20pt; +} +code { + background-color: #92869c; + border-style: dashed; + border-width: 2px; + border-color: #92869c; + padding: 5px; + color: black; +} +footer { + text-align: center; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613297a923965e0703b64796.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613297a923965e0703b64796.md new file mode 100644 index 00000000000..cf94c6d7765 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613297a923965e0703b64796.md @@ -0,0 +1,56 @@ +--- +id: 613297a923965e0703b64796 +title: 步驟 2 +challengeType: 0 +dashedName: step-2 +--- + +# --description-- + +你可能已經熟悉 `meta` 元素;它用於指定有關頁面的信息,例如標題、描述、關鍵詞和作者。 + +給你的頁面一個 `meta` 元素,然後給它的屬性 `charset` 一個合適的值。 + +`charset` 屬性指定了頁面的字符編碼,`UTF-8` 是現在大多數瀏覽器支持的唯一編碼。 + +# --hints-- + +你應該在 `head` 元素中創建一個 `meta` 元素。 + +```js +assert.exists(document.querySelector('head > meta')); +``` + +你應該給 `meta` 元素添加一個 `charset` 屬性,值爲 `UTF-8`。 + +```js +assert.equal(document.querySelector('head > meta')?.getAttribute('charset'), 'UTF-8'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +--fcc-editable-region-- + + + +--fcc-editable-region-- + + + + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133acc353338c0bba9cb553.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133acc353338c0bba9cb553.md new file mode 100644 index 00000000000..c23ad9d8357 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133acc353338c0bba9cb553.md @@ -0,0 +1,63 @@ +--- +id: 6133acc353338c0bba9cb553 +title: 步驟 5 +challengeType: 0 +dashedName: step-5 +--- + +# --description-- + +最後,在 `head` 元素中,`title` 元素對於屏幕閱讀器理解頁面內容很有用。 此外,它是 _SEO_ 的重要組成部分。 + +給你的頁面一個描述性的簡潔的 `title`。 + +# --hints-- + +你應該給 `head` 元素添加一個 `title` 元素。 + +```js +assert.exists(document.querySelector('head > title')); +``` + +`title` 的文本不應超過 60 個字符。 + +```js +assert.isAtMost(document.querySelector('head > title')?.textContent?.length, 60); +``` + +嘗試讓你的 `title` 元素的文本作更多描述性說明。 _提示:至少 15 個字符_ + +```js +assert.isAtLeast(document.querySelector('head > title')?.textContent?.length, 15); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +--fcc-editable-region-- + + + + + + +--fcc-editable-region-- + + + + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133d11ef548f51f876149e3.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133d11ef548f51f876149e3.md new file mode 100644 index 00000000000..c37e40422ec --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133d11ef548f51f876149e3.md @@ -0,0 +1,68 @@ +--- +id: 6133d11ef548f51f876149e3 +title: 步驟 6 +challengeType: 0 +dashedName: step-6 +--- + +# --description-- + +導航是無障礙的核心部分,屏幕閱讀器依靠你提供你的頁面結構。 這是通過語義 HTML 元素完成的。 + +將 `header` 元素和 `main` 元素添加到你的頁面。 + +`header` 元素將用於介紹頁面,以及提供導航菜單。 + +`main` 元素將包含頁面的核心內容。 + +# --hints-- + +你應該將給 `body` 元素添加一個 `header` 元素。 + +```js +assert.exists(document.querySelector('body > header')); +``` + +你應該給 `body` 元素添加一個 `main` 元素。 + +```js +assert.exists(document.querySelector('body > main')); +``` + +`header` 元素應該在 `main` 元素之前。 + +```js +assert.exists(document.querySelector('header + main')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + +--fcc-editable-region-- + + + +--fcc-editable-region-- + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e2546d0594208229ada50.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e2546d0594208229ada50.md new file mode 100644 index 00000000000..6289a810bd7 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e2546d0594208229ada50.md @@ -0,0 +1,93 @@ +--- +id: 613e2546d0594208229ada50 +title: 步驟 7 +challengeType: 0 +dashedName: step-7 +--- + +# --description-- + +在 `header` 中,通過嵌套一個 `img` 元素、`h1` 元素和 `nav` 元素來提供有關頁面的上下文。 + +`img` 元素應該指向 `https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg`,並且有一個 `id` 爲 `logo`。 + +`h1` 元素應該包含文本 `HTML/CSS Quiz`。 + +# --hints-- + +你應該將 `img` 元素添加到 `header` 元素。 + +```js +assert.exists(document.querySelector('header > img')); +``` + +你應該將 `h1` 元素添加到 `header` 元素。 + +```js +assert.exists(document.querySelector('header > h1')); +``` + +你應該將 `nav` 元素添加到 `header` 元素。 + +```js +assert.exists(document.querySelector('header > nav')); +``` + +你應該按照依次添加 `img` 元素、`h1` 元素和 `nav` 元素。 + +```js +assert.exists(document.querySelector('img + h1 + nav')); +``` + +你應該給 `img` 元素添加一個 `src` 屬性,值爲 `https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg`。 + +```js +assert.equal(document.querySelector('img')?.src, 'https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg'); +``` + +你應該給 `img` 元素添加一個 `id` 屬性,值爲 `logo`。 + +```js +assert.equal(document.querySelector('img')?.id, 'logo'); +``` + +你應該給 `h1` 元素添加文本 `HTML/CSS Quiz`。 + +```js +assert.include(document.querySelector('h1')?.innerText?.toLowerCase(), 'html/css quiz'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + + +--fcc-editable-region-- +
+ +
+--fcc-editable-region-- +
+ + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e275749ebd008e74bb62e.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e275749ebd008e74bb62e.md new file mode 100644 index 00000000000..97661262089 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e275749ebd008e74bb62e.md @@ -0,0 +1,66 @@ +--- +id: 613e275749ebd008e74bb62e +title: 步驟 8 +challengeType: 0 +dashedName: step-8 +--- + +# --description-- + +_SVG_(可縮放矢量圖形)的一個有用之處是它包含一個 `path` 屬性,該屬性允許在不影響圖像分辨率的情況下縮放圖像。 + +`img` 當前是默認尺寸,這個尺寸太大。 可以使用它的 `id` 作爲選擇器來縮放圖像,並將 `width` 設置爲 `max(100px, 18vw)`。 + +# --hints-- + +你應該使用 `#logo` 選擇器來定位 `img` 元素。 + +```js +assert.exists(new __helpers.CSSHelp(document).getStyle('#logo')); +``` + +你應該給 `img` 元素添加一個值爲 `max(100px, 18vw)` 的 `width`。 + +```js +assert.equal(new __helpers.CSSHelp(document).getStyle('#logo')?.width, 'max(100px, 18vw)'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + + +
+ +

HTML/CSS Quiz

+ +
+
+ + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6141fabd6f75610664e908fd.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6141fabd6f75610664e908fd.md new file mode 100644 index 00000000000..2a90f6b69d9 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6141fabd6f75610664e908fd.md @@ -0,0 +1,125 @@ +--- +id: 6141fabd6f75610664e908fd +title: 步驟 14 +challengeType: 0 +dashedName: step-14 +--- + +# --description-- + +由於這是一個測試題,你需要給用戶提供一個表單以便他們提交答案。 你可以使用 `section` 元素在語義上分隔表單中的內容。 + +在 `main` 元素中,創建一個包含三個嵌套 `section` 元素的表單。 然後,使用正確的方法將表單提交到 `https://freecodecamp.org/practice-project/accessibility-quiz`。 + +# --hints-- + +你應該在 `main` 元素中嵌套一個 `form` 元素。 + +```js +assert.exists(document.querySelector('main > form')); +``` + +你應該在 `form` 元素中嵌套三個 `section` 元素。 + +```js +assert.equal(document.querySelectorAll('main > form > section')?.length, 3); +``` + +你應該給 `form` 元素一個 `action` 屬性。 + +```js +assert.notEmpty(document.querySelector('main > form')?.action); +``` + +你應該將 `action` 屬性的值設置爲 `https://freecodecamp.org/practice-project/accessibility-quiz`。 + +```js +assert.equal(document.querySelector('main > form')?.action, 'https://freecodecamp.org/practice-project/accessibility-quiz'); +``` + +你應該給 `form` 元素一個 `method` 屬性。 + +```js +assert.notEmpty(document.querySelector('main > form')?.method); +``` + +你應該給 `form` 元素一個 `method` 屬性,其值爲 `post`。 + +```js +assert.equal(document.querySelector('main > form')?.method?.toLowerCase(), 'post'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + + +
+ +

HTML/CSS Quiz

+ +
+--fcc-editable-region-- +
+ +
+--fcc-editable-region-- + + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} + +header { + width: 100%; + height: 50px; + background-color: #1b1b32; + display: flex; +} + +#logo { + width: max(100px, 18vw); + background-color: #0a0a23; + aspect-ratio: 35 / 4; + padding: 0.4rem; +} + +h1 { + color: #f1be32; + font-size: min(5vw, 1.2em); +} + +nav { + width: 50%; + max-width: 300px; + height: 50px; +} + +nav > ul { + display: flex; + justify-content: space-evenly; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614ccc21ea91ef1736b9b578.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614ccc21ea91ef1736b9b578.md new file mode 100644 index 00000000000..87ace3bfa33 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614ccc21ea91ef1736b9b578.md @@ -0,0 +1,50 @@ +--- +id: 614ccc21ea91ef1736b9b578 +title: 步驟 1 +challengeType: 0 +dashedName: step-1 +--- + +# --description-- + +歡迎來到無障礙測試題的第一部分。 你正在成爲一個經驗豐富的 HTML 和 CSS 開發者,我們從基本的模板帶你開始學習這些知識。 + +通過爲你的 `html` 元素添加一個 `lang` 屬性來開始這段無障礙之旅。 這將幫助屏幕閱讀器識別頁面的語言。 + +# --hints-- + +你應該給 `html` 元素一個 `lang` 屬性。 _提示:對於英文,你可以使用值 `en` 。_ + +```js +assert.match(code, //i); +// TODO: This should/could be fixed in the builder.js +// assert.notThrow(Intl.getCanonicalLocales(document.querySelector('html').lang)); +``` + +# --seed-- + +## --seed-contents-- + +```html + +--fcc-editable-region-- + + + + + + + + +--fcc-editable-region-- + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f33071498eb2472b87ddee4.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f33071498eb2472b87ddee4.md new file mode 100644 index 00000000000..1d10716225a --- /dev/null +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f33071498eb2472b87ddee4.md @@ -0,0 +1,43 @@ +--- +id: 5f33071498eb2472b87ddee4 +title: 第1步: +challengeType: 0 +dashedName: step-1 +--- + +# --description-- + +之前在Cat Photo App的最後幾個步驟中提過,構建網頁前需要一個基本的結構。 + +添加標籤 `` 和元素 `html` 。 + +# --hints-- + +需要先聲明`DOCTYPE` + +```js +assert(code.match(//i)); +``` + +需要一個起始標籤 `` + +```js +assert(code.match(//i)); +``` + +需要一個閉合標籤 `` 別忘了閉合標籤的尖括號 `<` 後需要有一個 `/` + +```js +assert(code.match(/<\/html>/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md index cdd62359751..9306b781337 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md @@ -1,6 +1,6 @@ --- id: 587d78af367417b2b2512b04 -title: Build a Product Landing Page +title: 制作一个产品登录页 challengeType: 14 forumTopicId: 301144 dashedName: build-a-product-landing-page @@ -8,87 +8,87 @@ dashedName: build-a-product-landing-page # --description-- -**Objective:** Build an app that is functionally similar to https://product-landing-page.freecodecamp.rocks +**目标:** 构建一个功能类似于 https://product-landing-page.freecodecamp.rocks 的应用程序 -**User Stories:** +**需求:** -1. Your product landing page should have a `header` element with a corresponding `id="header"` -1. You can see an image within the `header` element with a corresponding `id="header-img"` (A logo would make a good image here) -1. Within the `#header` element, you can see a `nav` element with a corresponding `id="nav-bar"` -1. You can see at least three clickable elements inside the `nav` element, each with the class `nav-link` -1. When you click a `.nav-link` button in the `nav` element, you are taken to the corresponding section of the landing page -1. You can watch an embedded product video with `id="video"` -1. Your landing page has a `form` element with a corresponding `id="form"` -1. Within the form, there is an `input` field with `id="email"` where you can enter an email address -1. The `#email` input field should have placeholder text to let users know what the field is for -1. The `#email` input field uses HTML5 validation to confirm that the entered text is an email address -1. Within the form, there is a submit `input` with a corresponding `id="submit"` -1. When you click the `#submit` element, the email is submitted to a static page (use this mock URL: `https://www.freecodecamp.com/email-submit`) -1. The navbar should always be at the top of the viewport -1. Your product landing page should have at least one media query -1. Your product landing page should utilize CSS flexbox at least once +1. 你的产品登录页应该有一个 `id="header"` 的 `header` 元素 +1. 你可以在 `header` 元素中看到一个 `id="header-img"` 的图像(比如一个 logo) +1. 在 `#header` 元素中,你可以看到一个 `id="nav-bar"` 的 `nav` 元素 +1. 在 `nav` 元素中,你可以看到至少三个可点击的元素,每个元素的 class 为 `nav-link` +1. 当你点击 `nav` 内的 `.nav-link` 按钮时,应滚动到登录页相应的部分 +1. 你可以观看一个 `id="video"` 的嵌入的产品视频 +1. 你的登录页有一个 `id="form"` 的 `form` 元素 +1. 在表单中,应存在一个 `id="email"` 的 `input` 输入框供用户填写邮箱地址 +1. 在 `#email` 输入框内应有描述该区域用途的占位符文本 +1. `#email` 输入框应该用 HTML5 验证来确认输入的内容是否为邮箱地址 +1. 在表单中,有一个 `id="submit"` 的 `input` 提交按钮 +1. 当你点击 `#submit` 元素时,邮箱会被提交到一个静态页面 (使用这个模拟 URL:`https://www.freecodecamp.com/email-submit`) +1. 导航栏应该始终位于视口的顶部 +1. 你的产品登陆页面至少要有一个媒体查询 +1. 你的产品登陆页面应该至少使用一次 CSS flexbox -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +完成需求并通过下面的所有测试来完成这个项目。 赋予它你自己的个人风格。 编程愉快! # --hints-- -You should have a `header` element with an `id` of `header` +你应该有一个 `id` 为 `header` 的 `header` 元素 ```js const el = document.getElementById('header') assert(!!el && el.tagName === 'HEADER') ``` -You should have an `img` element with an `id` of `header-img` +你应该有一个 `id` 为 `header-img` 的 `img` 元素 ```js const el = document.getElementById('header-img') assert(!!el && el.tagName === 'IMG') ``` -Your `#header-img` should be a descendant of the `#header` +你的 `#header-img` 元素应该是 `#header` 元素的子元素 ```js const els = document.querySelectorAll('#header #header-img') assert(els.length > 0) ``` -Your `#header-img` should have a `src` attribute +你的 `#header-img` 元素应该有一个 `src` 属性 ```js const el = document.getElementById('header-img') assert(!!el && !!el.src) ``` -Your `#header-img`’s `src` value should be a valid URL (starts with `http`) +你的 `#header-img` 元素的 `src` 属性应该有一个有效的 URL(以 `http` 开头) ```js const el = document.getElementById('header-img') assert(!!el && /^http/.test(el.src)) ``` -You should have a `nav` element with an `id` of `nav-bar` +你应该有一个 `id` 为 `nav-bar` 的 `nav` 元素 ```js const el = document.getElementById('nav-bar') assert(!!el && el.tagName === 'NAV') ``` -Your `#nav-bar` should be a descendant of the `#header` +你的 `#nav-bar` 元素应该是 `#header` 元素的子元素 ```js const els = document.querySelectorAll('#header #nav-bar') assert(els.length > 0) ``` -You should have at least 3 `.nav-link` elements within the `#nav-bar` +在 `#nav-bar` 内,你应该有至少三个 `.nav-link` 元素 ```js const els = document.querySelectorAll('#nav-bar .nav-link') assert(els.length >= 3) ``` -Each `.nav-link` element should have an `href` attribute +每个 `.nav-link` 元素应该有一个 `href` 元素 ```js const els = document.querySelectorAll('.nav-link') @@ -98,7 +98,7 @@ els.forEach(el => { assert(els.length > 0) ``` -Each `.nav-link` element should link to a corresponding element on the landing page (has an `href` with a value of another element's id. e.g. `#footer`) +每一个 `.nav-link` 元素应该链接到登陆页面上的相应元素(有一个 `href` 具有另一个元素的 id 的值,例如: `#footer`) ```js const els = document.querySelectorAll('.nav-link') @@ -109,91 +109,99 @@ els.forEach(el => { assert(els.length > 0) ``` -You should have a `video` or `iframe` element with an `id` of `video` +你应该有一个 `id` 为 `video` 的 `video` 或 `iframe` 元素 ```js const el = document.getElementById('video') assert(!!el && (el.tagName === 'VIDEO' || el.tagName === 'IFRAME')) ``` -Your `#video` should have a `src` attribute +你的 `#video` 元素应该有一个 `src` 属性 ```js -const el = document.getElementById('video') -assert(!!el && !!el.src) +let el = document.getElementById('video') +const sourceNode = el.children; +let sourceElement = null; +if (sourceNode.length) { + sourceElement = [...video.children].filter(el => el.localName === 'source')[0]; +} +if (sourceElement) { + el = sourceElement; +} +assert(el.hasAttribute('src')); ``` -You should have a `form` element with an `id` of `form` +你应该有一个 `id` 为 `form` 的 `form` 元素 ```js const el = document.getElementById('form') assert(!!el && el.tagName === 'FORM') ``` -You should have an `input` element with an `id of `email` +你应该有一个 `id` 为 `email` 的 `input` 元素 ```js const el = document.getElementById('email') assert(!!el && el.tagName === 'INPUT') ``` -Your `#email` should be a descendant of the `#form` +你的 `#email` 元素应该是 `#form` 元素的子元素 ```js const els = document.querySelectorAll('#form #email') assert(els.length > 0) ``` -Your `#email` should have the `placeholder` attribute with placeholder text +你的 `#email` 元素应该有 `placeholder` 属性与占位符文本 ```js const el = document.getElementById('email') assert(!!el && !!el.placeholder && el.placeholder.length > 0) ``` -Your `#email` should use HTML5 validation by setting its `type` to `email` +你的 `#email` 元素应该使用 HTML5 验证,方法是设置 `type` 为 `email` ```js const el = document.getElementById('email') assert(!!el && el.type === 'email') ``` -You should have an `input` element with an `id` of `submit` +你应该有一个 `id` 为 `submit` 的 `input` 元素 ```js const el = document.getElementById('submit') assert(!!el && el.tagName === 'INPUT') ``` -Your `#submit` should be a descendant of the `#form` +你的 `#submit` 元素应该是 `#form` 元素的子元素 ```js const els = document.querySelectorAll('#form #submit') assert(els.length > 0) ``` -Your `#submit` should have a `type` of `submit` +你的 `#submit` 元素应该具有 `type` 为 `submit` ```js const el = document.getElementById('submit') assert(!!el && el.type === 'submit') ``` -Your `#form` should have an `action` attribute of `https://www.freecodecamp.com/email-submit` +你的 `#form` 元素应该有值为 `https://www.freecodecamp.com/email-submit` 的 `action` 属性 ```js const el = document.getElementById('form') assert(!!el && el.action === 'https://www.freecodecamp.com/email-submit') ``` -Your `#email` should have a `name` attribute of `email` +你的 `#email` 元素应该具有值为 `email` 的 `name` 属性 ```js const el = document.getElementById('email') assert(!!el && el.name === 'email') ``` -Your `#nav-bar` should always be at the top of the viewport +你的 `#nav-bar` 元素应该始终位于视口的顶部 ```js const el = document.getElementById('nav-bar') @@ -202,13 +210,15 @@ const top2 = el?.offsetTop assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) ``` -Your Product Landing Page should use at least one media query +你的产品登陆页面至少要有一个媒体查询 ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` -Your Product Landing Page should use CSS Flexbox at least once +你的产品登陆页面应该至少使用一次 CSS Flexbox ```js const stylesheet = new __helpers.CSSHelp(document).getStyleSheet() diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md index 4d4b34d8539..0e6e446f24a 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md @@ -222,7 +222,9 @@ assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) 你的技术文档项目应该使用至少一个媒体查询。 ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md index 231292b4373..a37544560b8 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md @@ -1,6 +1,6 @@ --- id: bd7158d8c442eddfaeb5bd18 -title: Build a Tribute Page +title: 制作一个致敬页 challengeType: 14 forumTopicId: 301147 dashedName: build-a-tribute-page @@ -8,32 +8,32 @@ dashedName: build-a-tribute-page # --description-- -**Objective:** Build an app that is functionally similar to https://tribute-page.freecodecamp.rocks +**目标:** 构建一个功能类似于 https://tribute-page.freecodecamp.rocks 的应用程序 -**User Stories:** +**需求:** -1. Your tribute page should have an element with a corresponding `id="main"`, which contains all other elements -1. You should see an element with an `id` of `title`, which contains a string (i.e. text), that describes the subject of the tribute page (e.g. "Dr. Norman Borlaug") -1. You should see either a `figure` or a `div` element with an `id` of `img-div` -1. Within the `img-div` element, you should see an `img` element with a corresponding `id="image"` -1. Within the `img-div` element, you should see an element with a corresponding `id="img-caption"` that contains textual content describing the image shown in `img-div` -1. You should see an element with a corresponding `id="tribute-info"`, which contains textual content describing the subject of the tribute page -1. You should see an a element with a corresponding `id="tribute-link"`, which links to an outside site, that contains additional information about the subject of the tribute page. HINT: You must give your element an attribute of `target` and set it to `_blank` in order for your link to open in a new tab -1. Your `#image` should use `max-width` and `height` properties to resize responsively, relative to the width of its parent element, without exceeding its original size -1. Your `img` element should be centered within its parent element +1. 你的致敬页面应该有一个 `id="main"` 的元素,该元素包含所有其他元素 +1. 你应该会看到一个 `id` 为 `title` 的元素,其中包含一个字符串(即文本),描述了致敬页面的主题(例如 “Dr. Norman Borlaug”) +1. 你应该有一个 `id` 为 `img-div` 的 `figure` 或 `div` 元素 +1. 在 `img-div` 元素中,你应该看到一个 `id="image"` 的 `img` 元素 +1. 在`img-div`元素内,你应该看到一个 `id="img-caption"` 的元素,其中包含对 `img-div` 中图像的文本描述 +1. 你应该看到一个 `id="tribute-info"` 的元素,其中包含描述致敬页主题的文本内容 +1. 你应该看到一个 `id="tribute-link"` 的元素,它链接到一个包含有关致敬页主题额外信息的外部网页。 提示:你必须为元素提供 `target` 属性,并设置其为 `_blank`,以便可以在新选项卡中打开链接。 +1. 你的 `#image` 应该使用 `max-width` 和 `height` 属性来响应式调整大小,相对于其父元素的宽度,但不超过其原始大小 +1. 你的 `img` 元素应该在其父元素内居中 -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +完成需求并通过下面的所有测试来完成这个项目。 赋予它你自己的个人风格。 编程愉快! # --hints-- -You should have a `main` element with an `id` of `main` +你的页面应该包含一个 `main` 元素,且它有一个值为`main` 的`id`属性。 ```js const el = document.getElementById('main') assert(!!el && el.tagName === 'MAIN') ``` -Your `#img-div`, `#image`, `#img-caption`, `#tribute-info`, and `#tribute-link` should all be descendants of `#main` +你的 `#img-div`、`#image`、`#img-caption`、`#tribute-info` 和 `#tribute-link` 应该是 `#main` 的子元素。 ```js const el1 = document.querySelector('#main #img-div') @@ -44,14 +44,14 @@ const el5 = document.querySelector('#main #tribute-link') assert(!!el1 & !!el2 && !!el3 && !!el4 && !!el5) ``` -You should have an element with an `id` of `title` +你应该有一个 `id` 为 `title` 的元素。 ```js const el = document.getElementById('title') assert(!!el) ``` -Your `#title` should not be empty +你的 `#title` 不应为空。 ```js const el = document.getElementById('title') @@ -59,120 +59,116 @@ assert(!!el && el.innerText.length > 0) ``` -You should have a `figure` or `div` element with an `id` of `img-div` +你应该有一个 `id` 为 `img-div` 的 `figure` 或 `div` 元素。 ```js const el = document.getElementById('img-div') assert(!!el && (el.tagName === 'DIV' || el.tagName === 'FIGURE')) ``` -You should have an `img` element with an `id` of `image` +你应该有一个 `id` 为 `image` 的 `img` 元素。 ```js const el = document.getElementById('image') assert(!!el && el.tagName === 'IMG') ``` -Your `#image` should be a descendant of `#img-div` +你的 `#image` 元素应该是 `#img-div` 元素的子元素。 ```js const el = document.querySelector('#img-div #image') assert(!!el) ``` -You should have a `figcaption` or `div` element with an `id` of `img-caption` +你应该有一个 `id` 为 `img-caption` 的 `figcaption` 或 `div` 元素。 ```js const el = document.getElementById('img-caption') assert(!!el && (el.tagName === 'DIV' || el.tagName === 'FIGCAPTION')) ``` -Your `#img-caption` should be a descendant of `#img-div` +你的 `#img-caption` 元素应该是 `#img-div` 元素的子元素。 ```js const el = document.querySelector('#img-div #img-caption') assert(!!el) ``` -Your `#img-caption` should not be empty +你的 `#img-caption` 不应为空。 ```js const el = document.getElementById('img-caption') assert(!!el && el.innerText.length > 0) ``` -You should have an element with an `id` of `tribute-info` +你应该有一个 `id` 为 `tribute-info` 的元素。 ```js const el = document.getElementById('tribute-info') assert(!!el) ``` -Your `#tribute-info` should not be empty +你的 `#tribute-info` 不应为空。 ```js const el = document.getElementById('tribute-info') assert(!!el && el.innerText.length > 0) ``` -You should have an `a` element with an `id` of `tribute-link` +你应该有一个 `id` 为 `tribute-link` 的 `a` 元素。 ```js const el = document.getElementById('tribute-link') assert(!!el && el.tagName === 'A') ``` -Your `#tribute-link` should have an `href` attribute and value +你的 `#tribute-link` 应该有一个 `href` 属性和值。 ```js const el = document.getElementById('tribute-link') assert(!!el && !!el.href && el.href.length > 0) ``` -Your `#tribute-link` should have a `target` attribute set to `_blank` +你的 `#tribute-link` 元素应该有一个值为 `_blank` 的 `target` 属性。 ```js const el = document.getElementById('tribute-link') assert(!!el && el.target === '_blank') ``` -You should use an `#image` selector in your CSS to style the `#image` and pass the next three tests +你的 `img` 元素应该具有 `display` 值为 `block`。 ```js -const style = new __helpers.CSSHelp(document).getStyle('#image') -assert(!!style) -``` - -Your `#image` should have a `display` of `block` - -```js -const style = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('display') +const img = document.getElementById('image'); +const imgStyle = window.getComputedStyle(img); +const style = imgStyle?.getPropertyValue('display') assert(style === 'block') ``` -Your `#image` should have a `max-width` of `100%` +你的 `#image` 元素应该具有 `max-width` 值为 `100%`。 ```js -const style = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('max-width') +const img = document.getElementById('image'); +const imgStyle = window.getComputedStyle(img); +const style = imgStyle?.getPropertyValue('max-width') assert(style === '100%') ``` -Your `#image` should have a `height` of `auto` +你的 `#image` 元素应该具有 `height` 值为 `auto`。 ```js // taken from the testable-projects repo const img = document.getElementById('image'); -const maxWidthValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('max-width') -const displayValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('display') -const oldDisplayValue = img?.style.getPropertyValue('display'); -const oldDisplayPriority = img?.style.getPropertyPriority('display'); +const imgStyle = window.getComputedStyle(img); +const oldDisplayValue = imgStyle.getPropertyValue('display'); +const oldDisplayPriority = imgStyle.getPropertyPriority('display'); img?.style.setProperty('display', 'none', 'important'); -const heightValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('height') +const heightValue = imgStyle?.getPropertyValue('height') img?.style.setProperty('display', oldDisplayValue, oldDisplayPriority); assert(heightValue === 'auto') ``` -Your `#image` should be centered within its parent +你的 `#image` 元素应该在其父元素内居中。 ```js // taken from the testable-projects repo diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md index b5f351a60f1..860814c719d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md @@ -8,7 +8,7 @@ dashedName: create-complex-multi-dimensional-arrays # --description-- -很好! 你现在已经学到很多关于数组的知识了, 但这些只是个开始。我们将在接下来的中挑战中学到更多与数组相关的知识。 在继续学习对象(Objects)之前,让我们再花一点时间了解下更复杂的数组嵌套。 +很好! 你现在已经学到很多关于数组的知识了, 但这些只是个开始。我们将在接下来的中挑战中学到更多与数组相关的知识。 但在继续查看 对象 之前,让我们再看一下,看看数组如何变得比我们在之前的挑战中看到的更复杂一些。 数组的一个强大的特性是,它可以包含其他数组,甚至完全由其他数组组成。 在上一个挑战中,我们已经接触到了包含数组的数组,但它还算是比较简单的。 数组中的数组还可以再包含其他数组,即可以嵌套任意多层数组。 通过这种方式,数组可以很快成为非常复杂的数据结构,称为多维(multi-dimensional)数组,或嵌套(nested)数组。 请看如下的示例: diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index d48cd193ec4..02a04432700 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -17,19 +17,19 @@ dashedName: understanding-uninitialized-variables # --hints-- -`a` 应该被定义,并且值为 `6`。 +应该定义变量 `a`,且它的值为 `6`。 ```js assert(typeof a === 'number' && a === 6); ``` -`b` 应该被定义,并且值为 `15`。 +应该定义变量 `b`,且它最终的值为 `15`。 ```js assert(typeof b === 'number' && b === 15); ``` -`c` 的值不能包含 `undefined`,应该为字符串 `I am a String!`。 +变量 `c` 的值不能包含 `undefined`,应该为字符串 `I am a String!`。 ```js assert(!/undefined/.test(c) && c === 'I am a String!'); diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md new file mode 100644 index 00000000000..822f83d2409 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md @@ -0,0 +1,279 @@ +--- +id: bd7158d8c242eddfaeb5bd13 +title: 制作一个个人作品集展示页 +challengeType: 14 +forumTopicId: 301143 +dashedName: build-a-personal-portfolio-webpage +--- + +# --description-- + +**目标:** 构建一个功能类似于 https://personal-portfolio.freecodecamp.rocks 的应用程序 + +**需求:** + +1. 你的作品集应该有一个 `id` 为 `welcome-section` 的欢迎部分 +1. 欢迎部分应该有一个包含文本的 `h1` 元素 +1. 你的作品集应该有一个 `id` 为 `projects` 的项目部分 +1. 项目部分应该包含至少一个 `class` 为 `project-tile` 的元素来保存项目 +1. 项目部分应该包含至少一个项目的链接 +1. 你的作品集应该有一个 id 为 `navbar` 的导航栏 +1. 导航栏应该至少包含一个链接,你可以点击它来导航到页面的不同部分 +1. 你的作品集应该有一个 id 为 `profile-link` 的链接,在新标签中打开你的 GitHub 或 freeCodeCodeCamp 个人主页 +1. 你的作品集应该至少有一个媒体查询 +1. 欢迎部分的高度应该等于视口的高度 +1. 导航栏应该始终位于视口的顶部 + +完成需求并通过下面的所有测试来完成这个项目。 赋予它你自己的个人风格。 编程愉快! + +# --hints-- + +你的作品集应该有一个 `id` 为 `welcome-section` 的欢迎部分。 + +```js +const el = document.getElementById('welcome-section') +assert(!!el); +``` + +你的 `#welcome-section` 元素应该包含一个 `h1` 元素。 + +```js +assert.isAbove( + document.querySelectorAll('#welcome-section h1').length, + 0, + 'Welcome section should contain an h1 element ' +); +``` + +在 `#welcome-section` 元素中,你不应该有任何空的 `h1` 元素。 + +```js +assert.isAbove( + document.querySelectorAll('#welcome-section h1')?.[0]?.innerText?.length, + 0, + 'h1 element in welcome section should contain your name or camper ' + + 'name ' +); +``` + +你应该有一个 `id` 为 `projects` 的项目部分。 + +```js +const el = document.getElementById('projects') +assert(!!el); +``` + +你的作品集应该包含至少一个 class 为 `project-tile` 的元素。 + +```js +assert.isAbove( + document.querySelectorAll('#projects .project-tile').length, + 0 +); +``` + +你的 `#projects` 元素应该包含至少一个 `a` 元素。 + +```js +assert.isAbove(document.querySelectorAll('#projects a').length, 0); +``` + +你的作品集应该有一个 `id` 为 `navbar` 的导航栏。 + +```js +const el = document.getElementById('navbar'); +assert(!!el); +``` + +你的 `#navbar` 元素应该包含至少一个 `a` 元素,它的 `href` 属性以 `#` 开头。 + +```js +const links = [...document.querySelectorAll('#navbar a')].filter( + (nav) => (nav?.getAttribute('href') || '').substr(0, 1) === '#' +); + +assert.isAbove( + links.length, + 0, + 'Navbar should contain an anchor link ' +); +``` + +你的作品集应该有一个 `id` 为 `profile-link` 的 `a` 元素。 + +```js +const el = document.getElementById('profile-link'); +assert(!!el && el.tagName === 'A') +``` + +你的 `#profile-link` 元素应该有一个值为 `_blank` 的 `target` 属性。 + +```js +const el = document.getElementById('profile-link'); +assert(!!el && el.target === '_blank') +``` + +你的作品集应该至少有一个媒体查询。 + +```js +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); +``` + +你的 `#navbar` 元素应该始终位于视口的顶部。 + +```js +(async () => { + const timeout = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)); + + const navbar = document.getElementById('navbar'); + assert.approximately( + navbar?.getBoundingClientRect().top, + 0, + 15, + "Navbar's parent should be body and it should be at the top of " + + 'the viewport ' + ); + + window.scroll(0, 500); + + await timeout(1); + + assert.approximately( + navbar?.getBoundingClientRect().top, + 0, + 15, + 'Navbar should be at the top of the viewport even after ' + + 'scrolling ' + ); + window.scroll(0, 0); +})(); +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Personal Portfolio + + + + + +
+
+
+

It's me!

+ +

Naomi Carrigan

+

Welcome to my portfolio page!

+

+
+

Projects

+

Here's what I've worked on!

+

+ + + + +


+
+

Contact me!

+

Use the links below to get in touch.

+

FreeCodeCamp.org | GitHub | Facebook | LinkedIn +

+ + + +``` + +```css +nav{ + position: fixed; + width: 100%; + text-align: right; + font-size: 24pt; + top: 0%; + right: 5px; + background-color: #000000; + color: #ffffff; +} +@media (max-width: 500px){ + nav{ + display: none; + } +} +a{ + color: #ffffff; +} +main{ + text-align: center; + background-color: black; + font-family:Pacifico +} +h1{ + font-size: 48pt; +} +h2{ + font-size: 24pt; +} +p{ + font-size: 12pt; +} +#welcome-section{ + background-color:#251a4a; + color: #FFFFFF; + display: table-cell; + vertical-align: middle; + width: 100vw; + height: 100vh; +} +#projects{ + background-color: #060a9c; + color: #ffffff; + display: table-cell; + vertical-align: middle; + width: 100vw; + height: 100vh; +} +#contact{ + background-color: #03300b; + color: #ffffff; + display: table-cell; + vertical-align: middle; + width: 100vw; + height: 100vh; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md new file mode 100644 index 00000000000..2459233b495 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md @@ -0,0 +1,434 @@ +--- +id: 587d78af367417b2b2512b04 +title: 制作一个产品登录页 +challengeType: 14 +forumTopicId: 301144 +dashedName: build-a-product-landing-page +--- + +# --description-- + +**目标:** 构建一个功能类似于 https://product-landing-page.freecodecamp.rocks 的应用程序 + +**需求:** + +1. 你的产品登录页应该有一个 `id="header"` 的 `header` 元素 +1. 你可以在 `header` 元素中看到一个 `id="header-img"` 的图像(比如一个 logo) +1. 在 `#header` 元素中,你可以看到一个 `id="nav-bar"` 的 `nav` 元素 +1. 在 `nav` 元素中,你可以看到至少三个可点击的元素,每个元素的 class 为 `nav-link` +1. 当你点击 `nav` 内的 `.nav-link` 按钮时,应滚动到登录页相应的部分 +1. 你可以观看一个 `id="video"` 的嵌入的产品视频 +1. 你的登录页有一个 `id="form"` 的 `form` 元素 +1. 在表单中,应存在一个 `id="email"` 的 `input` 输入框供用户填写邮箱地址 +1. 在 `#email` 输入框内应有描述该区域用途的占位符文本 +1. `#email` 输入框应该用 HTML5 验证来确认输入的内容是否为邮箱地址 +1. 在表单中,有一个 `id="submit"` 的 `input` 提交按钮 +1. 当你点击 `#submit` 元素时,邮箱会被提交到一个静态页面 (使用这个模拟 URL:`https://www.freecodecamp.com/email-submit`) +1. 导航栏应该始终位于视口的顶部 +1. 你的产品登陆页面至少要有一个媒体查询 +1. 你的产品登陆页面应该至少使用一次 CSS flexbox + +完成需求并通过下面的所有测试来完成这个项目。 赋予它你自己的个人风格。 编程愉快! + +# --hints-- + +你应该有一个 `id` 为 `header` 的 `header` 元素。 + +```js +const el = document.getElementById('header') +assert(!!el && el.tagName === 'HEADER') +``` + +你应该有一个 `id` 为 `header-img` 的 `img` 元素。 + +```js +const el = document.getElementById('header-img') +assert(!!el && el.tagName === 'IMG') +``` + +你的 `#header-img` 元素应该是 `#header` 元素的子元素。 + +```js +const els = document.querySelectorAll('#header #header-img') +assert(els.length > 0) +``` + +你的 `#header-img` 元素应该有一个 `src` 属性。 + +```js +const el = document.getElementById('header-img') +assert(!!el && !!el.src) +``` + +你的 `#header-img` 元素的 `src` 属性应该有一个有效的 URL(以 `http` 开头)。 + +```js +const el = document.getElementById('header-img') +assert(!!el && /^http/.test(el.src)) +``` + +你应该有一个 `id` 为 `nav-bar` 的 `nav` 元素。 + +```js +const el = document.getElementById('nav-bar') +assert(!!el && el.tagName === 'NAV') +``` + +你的 `#nav-bar` 元素应该是 `#header` 元素的子元素。 + +```js +const els = document.querySelectorAll('#header #nav-bar') +assert(els.length > 0) +``` + +在 `#nav-bar` 内,你应该有至少三个 `.nav-link` 元素。 + +```js +const els = document.querySelectorAll('#nav-bar .nav-link') +assert(els.length >= 3) +``` + +每个 `.nav-link` 元素应该有一个 `href` 元素。 + +```js +const els = document.querySelectorAll('.nav-link') +els.forEach(el => { + if (!el.href) assert(false) +}) +assert(els.length > 0) +``` + +每个 `.nav-link` 元素应该链接到登陆页面上的相应元素(有一个 `href` 具有另一个元素的 id 的值,例如: `#footer`)。 + +```js +const els = document.querySelectorAll('.nav-link') +els.forEach(el => { + const linkDestination = el.getAttribute('href').slice(1) + if (!document.getElementById(linkDestination)) assert(false) +}) +assert(els.length > 0) +``` + +你应该有一个 `id` 为 `video` 的 `video` 或 `iframe` 元素。 + +```js +const el = document.getElementById('video') +assert(!!el && (el.tagName === 'VIDEO' || el.tagName === 'IFRAME')) +``` + +你的 `#video` 元素应该有一个 `src` 属性。 + +```js +let el = document.getElementById('video') +const sourceNode = el.children; +let sourceElement = null; +if (sourceNode.length) { + sourceElement = [...video.children].filter(el => el.localName === 'source')[0]; +} +if (sourceElement) { + el = sourceElement; +} +assert(el.hasAttribute('src')); +``` + +你应该有一个 `id` 为 `form` 的 `form` 元素。 + +```js +const el = document.getElementById('form') +assert(!!el && el.tagName === 'FORM') +``` + +你应该有一个 `id` 为 `email` 的 `input` 元素。 + +```js +const el = document.getElementById('email') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#email` 元素应该是 `#form` 元素的子元素。 + +```js +const els = document.querySelectorAll('#form #email') +assert(els.length > 0) +``` + +你的 `#email` 元素应该有 `placeholder` 属性与占位符文本。 + +```js +const el = document.getElementById('email') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你的 `#email` 元素应该使用 HTML5 验证,方法是设置 `type` 为 `email`。 + +```js +const el = document.getElementById('email') +assert(!!el && el.type === 'email') +``` + +你应该有一个 `id` 为 `submit` 的 `input` 元素。 + +```js +const el = document.getElementById('submit') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#submit` 元素应该是 `#form` 元素的子元素。 + +```js +const els = document.querySelectorAll('#form #submit') +assert(els.length > 0) +``` + +你的 `#submit` 元素应该具有 `type` 为 `submit`。 + +```js +const el = document.getElementById('submit') +assert(!!el && el.type === 'submit') +``` + +你的 `#form` 元素应该有值为 `https://www.freecodecamp.com/email-submit` 的 `action` 属性。 + +```js +const el = document.getElementById('form') +assert(!!el && el.action === 'https://www.freecodecamp.com/email-submit') +``` + +你的 `#email` 元素应该具有值为 `email` 的 `name` 属性。 + +```js +const el = document.getElementById('email') +assert(!!el && el.name === 'email') +``` + +你的 `#nav-bar` 元素应该始终位于视口的顶部。 + +```js +const el = document.getElementById('nav-bar') +const top1 = el?.offsetTop +const top2 = el?.offsetTop +assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) +``` + +你的产品登陆页面至少要有一个媒体查询。 + +```js +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); +``` + +你的产品登陆页面应该至少使用一次 CSS Flexbox。 + +```js +const stylesheet = new __helpers.CSSHelp(document).getStyleSheet() +const cssRules = new __helpers.CSSHelp(document).styleSheetToCssRulesArray(stylesheet) +const usesFlex = cssRules.find(rule => { + return rule.style?.display === 'flex' || rule.style?.display === 'inline-flex' +}) +assert(usesFlex) +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Product Landing Page + + + +
+

+ Pokemon Daycare Service +

+
+

What we offer

+
+
+ +
+
Guaranteed friendly and loving staff!
+
+
+
+ +
+
+ Comfortable environment for Pokemon to explore and play! +
+
+
+
+ +
+
+ Multiple membership plans to fit your lifestyle! +
+
+
+
+

Check us out!

+ A sneak peek into our facility: +
+ +
+
+

Membership Plans

+
+
+ Basic Membership
+
    +
  • One Pokemon
  • +
  • Food and berries provided
  • +
+ $9.99/month +
+
+ Silver Membership
+
    +
  • Up to Three Pokemon
  • +
  • Food and berries provided
  • +
  • Grooming and accessories included
  • +
+ $19.99/month +
+
+ Gold Membership
+
    +
  • Up to six Pokemon!
  • +
  • Food and berries provided
  • +
  • Grooming and accessories included
  • +
  • Personal training for each Pokemon
  • +
  • Breeding and egg hatching
  • +
+ $29.99/month +
+
+
+
+

Sign up for our newsletter!

+ + +
+ +
+ + +``` + +```css +body { + background-color: #3a3240; + color: white; +} +main { + max-width: 750px; + margin: 50px auto; +} +input { + background-color: #92869c; +} +a:not(.nav-link) { + color: white; +} +#header-img { + max-height: 25px; +} +#nav-bar { + position: fixed; + width: 100%; + text-align: center; + top: 0%; + background-color: #92869c; +} +h1 { + text-align: center; +} +body { + text-align: center; +} +footer { + text-align: center; +} +#bullet { + max-height: 25px; +} +.flex-here { + display: flex; + justify-content: center; +} +.flex-left { + height: 25px; +} +.flex-mem { + display: flex; + justify-content: center; +} +.flex-mem-box { + background-color: #92869c; + border-color: black; + border-width: 5px; + border-style: solid; + margin: 10px; + padding: 10px; + color: black; +} +@media (max-width: 350px) { + #video { + width: 300; + height: 200; + } +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-survey-form-project/build-a-survey-form.md b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-survey-form-project/build-a-survey-form.md new file mode 100644 index 00000000000..109f47fb6d4 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-survey-form-project/build-a-survey-form.md @@ -0,0 +1,516 @@ +--- +id: 587d78af367417b2b2512b03 +title: 制作一个调查表格 +challengeType: 14 +forumTopicId: 301145 +dashedName: build-a-survey-form +--- + +# --description-- + +**目标:** 构建一个功能类似于 https://survey-form.freecodecamp.rocks 的应用程序 + +**需求:** + +1. 你应该有一个 `id` 为 `title` 的 `h1` 元素 +1. 你应该有一个 `id` 为 `description` 的 `p` 元素 +1. 你应该有一个 `id` 为 `survey-form` 的 `form` 元素 +1. 在表单元素内,你**需要**在 `input` 字段中输入你的名字,该字段的 `id` 为 `name`,`type` 为 `text` +1. 在表单元素内,你**需要**在 `input` 字段中输入你的邮箱,该字段的 `id` 为 `email` +1. 如果你输入了格式不正确的邮箱,你将会看见 HTML5 验证错误信息 +1. 在表单中,你可以在 `input` 字段中输入一个数字,该字段的 `id` 为 `number` +1. 如果你在数字输入框内输入非数字内容,你会看到 HTML5 验证错误信息 +1. 如果你输入的数字超出了范围(使用 `min` 和 `max` 属性定义),你将会看见 HTML5 验证错误信息 +1. 表单中的名字、邮箱和数字输入框需有对应的包含描述输入框用途的 `label` 元素,id 应分别为 `id="name-label"`、`id="email-label"` 和 `id="number-label"` +1. 在表单中的名字、邮箱和数字输入框中,你能看到各自的描述文字作为占位符 +1. 在表单元素内, 你应该有一个 `select` 下拉元素, `id` 为 `dropdown`,它至少有两个选项 +1. 在表单元素内, 你可以从至少两个单选按钮的组中选择一个选项,该选项使用 `name` 属性 +1. 在表单元素内,你可以从一系列复选框中选择几个字段,每个复选框都必须具有 `value` 属性 +1. 在表单元素内,你会有一个 `textarea` 以获取额外的评论 +1. 在表单元素内,你将收到一个按钮,其 `id` 为 `submit`,提交所有输入 + +完成需求并通过下面的所有测试来完成这个项目。 赋予它你自己的个人风格。 编程愉快! + +# --hints-- + +你应该有一个 `id` 为 `title` 的 `h1` 元素。 + +```js +const el = document.getElementById('title') +assert(!!el && el.tagName === 'H1') +``` + +你的 `#title` 不应为空。 + +```js +const el = document.getElementById('title') +assert(!!el && el.innerText.length > 0) +``` + +你应该有一个 `id` 为 `description` 的 `p` 元素。 + +```js +const el = document.getElementById('description') +assert(!!el && el.tagName === 'P') +``` + +你的 `#description` 不应为空。 + +```js +const el = document.getElementById('description') +assert(!!el && el.innerText.length > 0) +``` + +你应该有一个 `id` 为 `survey-form` 的 `form` 元素。 + +```js +const el = document.getElementById('survey-form') +assert(!!el && el.tagName === 'FORM') +``` + +你应该有一个 `id` 为 `name` 的 `input` 元素。 + +```js +const el = document.getElementById('name') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#name` 元素应该具有 `type` 为 `text`。 + +```js +const el = document.getElementById('name') +assert(!!el && el.type === 'text') +``` + +你的 `#name` 元素应该需要输入。 + +```js +const el = document.getElementById('name') +assert(!!el && el.required) +``` + +你的 `#name` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #name') +assert(!!el) +``` + +你应该有一个 `id` 为 `email` 的 `input` 元素。 + +```js +const el = document.getElementById('email') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#email` 元素应该具有 `type` 为 `email`。 + +```js +const el = document.getElementById('email') +assert(!!el && el.type === 'email') +``` + +你的 `#email` 元素应该需要输入。 + +```js +const el = document.getElementById('email') +assert(!!el && el.required) +``` + +你的 `#email` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #email') +assert(!!el) +``` + +你应该有一个 `id` 为 `number` 的 `input` 元素。 + +```js +const el = document.getElementById('number') +assert(!!el && el.tagName === 'INPUT') +``` + +你的 `#number` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #number') +assert(!!el) +``` + +你的 `#number` 元素应该具有 `type` 为 `number`。 + +```js +const el = document.getElementById('number') +assert(!!el && el.type === 'number') +``` + +你的 `#number` 应该有一个值为数字的 `min` 属性。 + +```js +const el = document.getElementById('number') +assert(!!el && el.min && isFinite(el.min)) +``` + +你的 `#number` 应该有一个值为数字的 `max` 属性。 + +```js +const el = document.getElementById('number') +assert(!!el && el.max && isFinite(el.max)) +``` + +你应该有一个 `id` 为 `name-label` 的 `label` 元素。 + +```js +const el = document.getElementById('name-label') +assert(!!el && el.tagName === 'LABEL') +``` + +你应该有一个 `id` 为 `email-label` 的 `label` 元素。 + +```js +const el = document.getElementById('email-label') +assert(!!el && el.tagName === 'LABEL') +``` + +你应该有一个 `id` 为 `number-label` 的 `label` 元素。 + +```js +const el = document.getElementById('number-label') +assert(!!el && el.tagName === 'LABEL') +``` + +你的 `#name-label` 不应为空。 + +```js +const el = document.getElementById('name-label') +assert(!!el && el.innerText.length > 0) +``` + +你的 `#email-label` 不应为空。 + +```js +const el = document.getElementById('email-label') +assert(!!el && el.innerText.length > 0) +``` + +你的 `#number-label` 不应为空。 + +```js +const el = document.getElementById('number-label') +assert(!!el && el.innerText.length > 0) +``` + +你的 `#name-label` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #name-label') +assert(!!el) +``` + +你的 `#email-label` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #email-label') +assert(!!el) +``` + +你的 `#number-label` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #number-label') +assert(!!el) +``` + +你的 `#name` 元素应该有 `placeholder` 属性与占位符文本。 + +```js +const el = document.getElementById('name') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你的 `#email` 元素应该有 `placeholder` 属性与占位符文本。 + +```js +const el = document.getElementById('email') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你的 `#number` 元素应该有 `placeholder` 属性与占位符文本。 + +```js +const el = document.getElementById('number') +assert(!!el && !!el.placeholder && el.placeholder.length > 0) +``` + +你应该有一个 `id` 为 `dropdown` 的 `select` 元素。 + +```js +const el = document.getElementById('dropdown') +assert(!!el && el.tagName === 'SELECT') +``` + +你的 `#dropdown` 应该至少有两个可选择(未禁用)`option` 元素。 + +```js +const els = document.querySelectorAll('#dropdown option:not([disabled])') +assert(els.length >= 2) +``` + +你的 `#dropdown` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #dropdown') +assert(!!el) +``` + +你应该有至少两个 `input` 元素,`type` 为 `radio`(单选按钮)。 + +```js +const els = document.querySelectorAll('input[type="radio"]') +assert(els.length >= 2) +``` + +你至少应该有两个单选按钮,是 `#survey-form` 的子元素。 + +```js +const els = document.querySelectorAll('#survey-form input[type="radio"]') +assert(els.length >= 2) +``` + +你所有的单选按钮都应该有一个 `value` 属性和值。 + +```js +const els1 = document.querySelectorAll('input[type="radio"]') +const els2 = document.querySelectorAll('input[type="radio"][value=""], input[type="radio"]:not([value])') +assert(els1.length > 0 && els2.length === 0) +``` + +你所有的单选按钮都应该有一个 `name` 属性和值。 + +```js +const els1 = document.querySelectorAll('input[type="radio"]') +const els2 = document.querySelectorAll('input[type="radio"][name=""], input[type="radio"]:not([name])') +assert(els1.length > 0 && els2.length === 0) +``` + +每个单选按钮组应至少有 2 个单选按钮。 + +```js +const radioButtons = document.querySelectorAll('input[type="radio"]'); +const groups = {} + +if (radioButtons) { + radioButtons.forEach(el => { + if (!groups[el.name]) groups[el.name] = [] + groups[el.name].push(el) + }) +} + +const groupKeys = Object.keys(groups) + +groupKeys.forEach(key => { + if (groups[key].length < 2) assert(false) +}) + +assert(groupKeys.length > 0) +``` + +你应该至少有两个 `input` 元素,`type` 为 `checkbox`(复选框),它们是 `#survey-form` 的子元素。 + +```js +const els = document.querySelectorAll('#survey-form input[type="checkbox"]'); +assert(els.length >= 2) +``` + +你在 `#survey-form` 中的所有复选框都应该有 `value` 属性和值。 + +```js +const els1 = document.querySelectorAll('#survey-form input[type="checkbox"]') +const els2 = document.querySelectorAll('#survey-form input[type="checkbox"][value=""], #survey-form input[type="checkbox"]:not([value])') +assert(els1.length > 0 && els2.length === 0) +``` + +你至少应该有一个 `textarea` 元素,它是 `#survey-form` 的子元素。 + +```js +const el = document.querySelector('#survey-form textarea') +assert(!!el) +``` + +你应该有一个 `id` 为 `submit` 的 `input` 或 `button` 元素。 + +```js +const el = document.getElementById('submit') +assert(!!el && (el.tagName === 'INPUT' || el.tagName === 'BUTTON')) +``` + +你的 `#submit` 元素应该具有 `type` 为 `submit`。 + +```js +const el = document.getElementById('submit') +assert(!!el && el.type === 'submit') +``` + +你的 `#submit` 元素应该是 `#survey-form` 元素的子元素。 + +```js +const el = document.querySelector('#survey-form #submit') +assert(!!el) +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Survey Form + + +

Survey Form

+

The card below was built as a sample survey form for freeCodeCamp.

+
+

Join the Togepi Fan Club!

+

+ Enter your information here to receive updates about club activities, + our monthly newsletter, and other email communications. +

+
+ + + + +

Who is your favourite Pokemon?

+ + + +

Which communications do you want to receive?

+ + + +

Any other information you would like to share?

+ +

+ Please note: This form is a proof of concept. Submitting the form + will not actually transmit your data. +

+ +
+
+ + + +``` + +```css +main { + text-align: center; + background-color: #92869c; + background-blend-mode: lighten; + max-width: 500px; + margin: 20px auto; + border-radius: 50px; + box-shadow: 10px 10px rgba(0, 0, 0, 0.5); + color: black; +} +body { + text-align: center; + background: #3a3240; + color: white; +} +input, textarea, select, button { + background: #3a3240; + color: white; +} +a { + color: white; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md new file mode 100644 index 00000000000..346837ce006 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md @@ -0,0 +1,527 @@ +--- +id: 587d78b0367417b2b2512b05 +title: 制作一个技术文档页面 +challengeType: 14 +forumTopicId: 301146 +dashedName: build-a-technical-documentation-page +--- + +# --description-- + +**目标:** 构建一个功能类似于 https://technical-documentation-page.freecodecamp.rocks 的应用程序 + +**需求:** + +1. 你能看见一个 `id="main-doc"` 的 `main`元素,它包含页面的主要内容(技术文档)。 +1. 在 `#main-doc` 元素内,我能看见至少 5 个 `section` 元素,每个元素都有一个 class 为 `main-section`。 应存在至少 5 个这样的元素。 +1. 每个 `.main-section` 中的第一个元素应该是 `header` 元素,其中包含描述该部分主题的文本。 +1. class 为 `main-section` 的每个 `section` 元素应该有一个与包含在其中的每个 `header` 的文本相对应的 `id`。 所有空格都应该被替换为下划线(例如,包含标题 “JavaScript and Java” 的 section 应有一个相应的 `id="JavaScript_and_Java"`)。 +1. 所有 `.main-section` 元素总计(不是每个)包含至少 10 个 `p` 元素。 +1. 所有 `.main-section` 元素总计(不是每个)包含至少 5 个 `code` 元素。 +1. 所有 `.main-section` 元素总计(不是每个)包含至少 5 个 `li` 元素。 +1. 你能看见一个 `id="navbar"` 的 `nav` 元素。 +1. navbar 元素应包含一个 `header` 元素,其中包含描述技术文档主题的文本。 +1. 此外,导航栏应包含 class 为 `nav-link` 的链接元素(`a`)。 每个 class 为 `main-section` 的元素都需要有一个。 +1. `#navbar` 中的 `header` 元素必须在任何链接(`a`)之前。 +1. class 为 `nav-link` 的每个元素都应该包含每个 `section` 的 `header` 文本对应的文本(例如,如果你有一个 “Hello world” 部分/标题,你的导航栏应该有一个包含文本 “Hello world” 的元素)。 +1. 当你点击一个 navbar 元素时,页面应该导航到 `#main-doc` 元素的相应部分(例如,如果你点击包含文本 “Hello world” 的 `.nav-link` 元素,页面将导航到一个带有对应 header 和 id 的 `section` 元素)。 +1. 在常规尺寸的设备上(笔记本电脑、台式机),带有 `id="navbar"` 的元素应该显示在屏幕左侧,并且始终对用户可见。 +1. 你的技术文档应该使用至少一个媒体查询。 + +完成需求并通过下面的所有测试来完成这个项目。 赋予它你自己的个人风格。 编程愉快! + +# --hints-- + +你应该有一个 `id` 为 `main-doc` 的 `main` 元素。 + +```js +const el = document.getElementById('main-doc') +assert(!!el) +``` + +你至少应该有 5 个 class 为 `main-section` 的 `section` 元素。 + +```js +const els = document.querySelectorAll('#main-doc section') +assert(els.length >= 5) +``` + +你所有的 `.main-section` 元素都应该是 `section` 元素。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + if (el.tagName !== 'SECTION') assert(false) +}) +assert(els.length > 0) +``` + +你至少应该有 5 个 `.main-section` 元素,它们是 `#main-doc` 的子元素。 + +```js +const els = document.querySelectorAll('#main-doc .main-section') +assert(els.length >= 5) +``` + +每个 `.main-section` 的第一个子元素都应该是一个 `header` 元素。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + if(el.firstElementChild?.tagName !== 'HEADER') assert(false) +}) +assert(els.length > 0) +``` + +你的 `header` 元素不应为空。 + +```js +const els = document.querySelectorAll('header') +els.forEach(el => { + if (el.innerText?.length <= 0) assert(false) +}) +assert(els.length > 0) +``` + +你所有的 `.main-section` 元素都应该有 `id`。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + if (!el.id || el.id === '') assert(false) +}) +assert(els.length > 0) +``` + +每个 `.main-section` 都应该有一个与其第一个子元素的文本匹配的 `id`,把子元素的文本中的空格都替换为下划线(`_`)用于 id。 + +```js +const els = document.querySelectorAll('.main-section') +els.forEach(el => { + const text = el.firstElementChild?.innerText?.replaceAll(' ', '_') + if (el.id?.toUpperCase() !== text?.toUpperCase()) assert(false) +}) +assert(els.length > 0) +``` + +在你的 `.main-section` 元素中总计应有至少 10 个 `p` 元素 + +```js +const els = document.querySelectorAll('.main-section p') +assert(els.length >= 10) +``` + +所有 `.main-section` 元素内总计应有至少 5 个 `code` 元素。 + +```js +const els = document.querySelectorAll('.main-section code') +assert(els.length >= 5) +``` + +所有 `.main-section` 元素内总计应有至少 5 个 `li` 元素。 + +```js +const els = document.querySelectorAll('.main-section li') +assert(els.length >= 5) +``` + +你应该有一个 `id` 为 `navbar` 的 `nav` 元素。 + +```js +const el = document.getElementById('navbar') +assert(!!el && el.tagName === 'NAV') +``` + +你的 `#navbar` 应该只有一个 `header` 元素。 + +```js +const els = document.querySelectorAll('#navbar header') +assert(els.length === 1) +``` + +你应该至少有一个 class 为 `nav-link` 的 `a` 元素。 + +```js +const els = document.querySelectorAll('a[class="nav-link"]') +assert(els.length >= 1) +``` + +你所有的 `.nav-link` 元素都应该是锚点(`a`)元素。 + +```js +const els = document.querySelectorAll('.nav-link') +els.forEach(el => { + if (el.tagName !== 'A') assert(false) +}) +assert(els.length > 0) +``` + +你所有的 `.nav-link` 元素都应该在 `#navbar` 中。 + +```js +const els1 = document.querySelectorAll('.nav-link') +const els2 = document.querySelectorAll('#navbar .nav-link') +assert(els2.length > 0 && els1.length === els2.length) +``` + +你应该有相同数量的 `.nav-link` 和 `.main-section` 元素。 + +```js +const els1 = document.querySelectorAll('.main-section') +const els2 = document.querySelectorAll('.nav-link') +assert(els1.length > 0 && els2.length > 0 && els1.length === els2.length) +``` + +`#navbar` 中的 `header` 元素必须在 `#navbar` 中的任何链接(`a`)之前。 + +```js +const navLinks = document.querySelectorAll('#navbar a.nav-link'); +const header = document.querySelector('#navbar header'); +navLinks.forEach((navLink) => { + if ( + ( + header.compareDocumentPosition(navLink) & + Node.DOCUMENT_POSITION_PRECEDING + ) + ) assert(false) +}); +assert(!!header) +``` + +每个 `.nav-link` 应该有与其相关 `section` 的 `header` 文本相对应的文本(例如,如果你有一个 “Hello world” 部分/标题,你的 `#navbar` 应该有一个 `.nav-link` 包含文本 “Hello world”)。 + +```js +const headerText = Array.from(document.querySelectorAll('.main-section')).map(el => + el.firstElementChild?.innerText?.trim().toUpperCase() +) +const linkText = Array.from(document.querySelectorAll('.nav-link')).map(el => + el.innerText?.trim().toUpperCase() +) +const remainder = headerText.filter(str => linkText.indexOf(str) === -1) +assert(headerText.length > 0 && headerText.length > 0 && remainder.length === 0) +``` + +每个 `.nav-link` 都应该有一个 `href` 属性,该属性链接到其对应的 `.main-section`(例如,如果你单击包含文本 “Hello world” 的 `.nav-link` 元素,页面导航到具有该 id 的 `section` 元素)。 + +```js +const hrefValues = Array.from(document.querySelectorAll('.nav-link')).map(el => el.getAttribute('href')) +const mainSectionIDs = Array.from(document.querySelectorAll('.main-section')).map(el => el.id) +const missingHrefValues = mainSectionIDs.filter(str => hrefValues.indexOf('#' + str) === -1) +assert(hrefValues.length > 0 && mainSectionIDs.length > 0 && missingHrefValues.length === 0) +``` + +你的 `#navbar` 元素应该始终位于视口的顶部。 + +```js +const el = document.getElementById('navbar') +const left1 = el?.offsetLeft +const left2 = el?.offsetLeft +assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) +``` + +你的技术文档项目应该使用至少一个媒体查询。 + +```js +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); +``` + +# --seed-- + +## --seed-contents-- + +```html + +``` + +```css + +``` + +## --solutions-- + +```html + + + + + + Technical Documentation Page + + + +
+
+
Introduction
+

+ Welcome to a basic introduction of algebra. In this tutorial, we will + review some of the more common algebraic concepts. +

+
+
+
Definitions
+

+ To start with, let's define some of the more common terms used in + algebra: +

+
    +
  • + Variable: A variable is an unknown value, usually represented + by a letter. +
  • +
  • + Expression: Essentially a mathematical object. For the + purpose of this tutorial, an expression is one part of an equation. +
  • +
  • + Equation: An equation is a mathematical argument in which two + expressions result in the same value. +
  • +
+
+
+
Examples
+

+ Sometimes it is easier to understand the definitions when you have a + physical example to look at. Here is an example of the above terms.

+ x + 5 = 12

+ In this above example, we have: +

+
    +
  • Variable: The variable in the example is "x".
  • +
  • + Expression: There are two expressions in this example. They + are "x+5" and "12". +
  • +
  • + Equation: The entire example, "x+5=12", is an equation. +
  • +
+
+
+
Solving Equations
+

+ The primary use for algebra is to determine an unknown value, the + "variable", with the information provided. Continuing to use our + example from above, we can find the value of the variable "x".

+ x + 5 = 12

+ In an equation, both sides result in the same value. So you can + manipulate the two expressions however you need, as long as you + perform the same operation (or change) to each side. You do this + because the goal when solving an equation is to + get the variable into its own expression, or by itself on one side + of the = sign.
For this example, we want to remove the "+5" so the "x" is + alone. To do this, we can subtract 5, because subtraction is + the opposite operation to addition. But remember, we have to perform + the same operation to both sides of the equation. Now our equation + looks like this.

+ x + 5 - 5 = 12 - 5

+ The equation looks like a mess right now, because we haven't completed + the operations. We can simplify this equation to make it easier + to read by performing the operations "5-5" and "12-5". The result + is:

+ x = 7

+ We now have our solution to this equation! +

+
+
+
Solving Equations II
+

+ Let us look at a slightly more challenging equation.

+ 3x + 4 = 13

+ Again we can start with subtraction. In this case, we want to subtract + 4 from each side of the equation. We will also go ahead and simplify + with each step. So now we have:

+ 3x = 9

+ "3x" translates to "3*x", where the "*" symbol indicates + multiplication. We use the "*" to avoid confusion, as the "x" is now a + variable instead of a multiplication symbol. The opposite operation + for multiplication is division, so we need to + divide each expression by 3.

+ x = 3

+ And now we have our solution! +

+
+
+
Solving Equations III
+

+ Now we are getting in to more complex operations. Here is another + equation for us to look at:

+ x^2 - 8 = 8

+ Our very first step will be to add 8 to each side. This is + different from our previous examples, where we had to subtract. But + remember, our goal is to get the variable alone by performing opposite + operations.

+ x^2 = 16

+ But what does the "^2" mean? The "^" symbol is used to denote + exponents in situations where superscript is not available. When + superscript is available, you would see it as x2. + For the sake of this project, however, we will use the "^" symbol.
+ An exponent tells you how many times the base (in our case, "x") is + multiplied by itself. So, "x^2" would be the same as "x*x". Now the + opposite function of multiplication is division, but we would have to + divide both sides by "x". We do not want to do this, as that + would put an "x" on the other side of the equation. So instead, we + need to use the root operation! For an exponent of "2", we call this + the "square root" and denote it with "√". Our equation is now: +

+ x = √9

+ Performing a root operation by hand can be a tedious process, so we + recommend using a calculator when necessary. However, we are lucky in + that "9" is a + perfect square, so we do not need to calculate anything. Instead, we find our + answer to be:

+ x = 3 +

+
+
+
System of Equations
+

+ As you explore your algebra studies further, you may start to run + across equations with more than one variable. The first such equations + will likely look like:

+ y = 3x

+ An equation like this does not have one single solution. + Rather, there are a series of values for which the equation is true. + For example, if "x=3" and "y=9", the equation is true. These equations + are usually used to plot a graph.
+ Getting more complicated, though, you may be given a pair of + equations. This is called a "system of equations", and CAN be solved. + Let's look at how we do this! Consider the following system of + equations:

+ y = 3x | y - 6 = x + A system of equations IS solvable, but it is a multi-step process. To + get started, we need to chose a variable we are solving for. Let's + solve for "x" first. From the second equation, we know that "x" equals + "y - 6", but we cannot simplify that further because we do not have a + value for "y". Except, thanks to the system of equations, we DO have a + value for "y". We know that "y" equals "3x". So, looking at our second + equation, we can replace "y" with "3x" because they have the same + value. We then get:

+ 3x - 6 = x

+ Now we can solve for "x"! We start by adding 6 to each side.

+ 3x = x + 6

+ We still need to get "x" by itself, so we subtract "x" from both sides + and get:

+ 2x = 6

+ If this confuses you, remember that "3x" is the same as "x+x+x". + Subtract an "x" from that and you get "x+x", or "2x". Now we divide + both sides by 2 and have our value for x!

+ x = 3

+ However, our work is not done yet. We still need to find the value for + "y". Let's go back to our first equation:

+ y = 3x

+ We have a value for "x" now, so let's see what happens if we put that + value in.

+ y = 3*3

+ We perform the multiplication and discover that "y=9"! Our solution to + this system of equations then is:

+ x = 3 and y = 9

+

+
+
+
Try it Yourself!
+

Coming Soon!

+

Keep an eye out for new additions!

+
+
+
More Information
+

Check out the following links for more information!

+ +
+
+ + + +``` + +```css +* { + background-color: #3a3240; +} +a { + color: #92869c; +} +a:hover { + background-color: #92869c; + color: #3a3240; +} +#navbar { + border-style: solid; + border-width: 5px; + border-color: #92869c; + height: 100%; + top: -5px; + left: -5px; + padding: 5px; + text-align: center; + color: #92869c +} +@media (min-width: 480px) { + #navbar { + position: fixed; + } +} +main { + margin-left: 220px; + color: #92869c +} +header { + font-size: 20pt; +} +code { + background-color: #92869c; + border-style: dashed; + border-width: 2px; + border-color: #92869c; + padding: 5px; + color: black; +} +footer { + text-align: center; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613297a923965e0703b64796.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613297a923965e0703b64796.md new file mode 100644 index 00000000000..57656c63e37 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613297a923965e0703b64796.md @@ -0,0 +1,56 @@ +--- +id: 613297a923965e0703b64796 +title: 步骤 2 +challengeType: 0 +dashedName: step-2 +--- + +# --description-- + +你可能已经熟悉 `meta` 元素;它用于指定有关页面的信息,例如标题、描述、关键词和作者。 + +给你的页面一个 `meta` 元素,然后给它的属性 `charset` 一个合适的值。 + +`charset` 属性指定了页面的字符编码,`UTF-8` 是现在大多数浏览器支持的唯一编码。 + +# --hints-- + +你应该在 `head` 元素中创建一个 `meta` 元素。 + +```js +assert.exists(document.querySelector('head > meta')); +``` + +你应该给 `meta` 元素添加一个 `charset` 属性,值为 `UTF-8`。 + +```js +assert.equal(document.querySelector('head > meta')?.getAttribute('charset'), 'UTF-8'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +--fcc-editable-region-- + + + +--fcc-editable-region-- + + + + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133acc353338c0bba9cb553.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133acc353338c0bba9cb553.md new file mode 100644 index 00000000000..d06cd33fa59 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133acc353338c0bba9cb553.md @@ -0,0 +1,63 @@ +--- +id: 6133acc353338c0bba9cb553 +title: 步骤 5 +challengeType: 0 +dashedName: step-5 +--- + +# --description-- + +最后,在 `head` 元素中,`title` 元素对于屏幕阅读器理解页面内容很有用。 此外,它是 _SEO_ 的重要组成部分。 + +给你的页面一个描述性的简洁的 `title`。 + +# --hints-- + +你应该给 `head` 元素添加一个 `title` 元素。 + +```js +assert.exists(document.querySelector('head > title')); +``` + +`title` 的文本不应超过 60 个字符。 + +```js +assert.isAtMost(document.querySelector('head > title')?.textContent?.length, 60); +``` + +尝试让你的 `title` 元素的文本作更多描述性说明。 _提示:至少 15 个字符_ + +```js +assert.isAtLeast(document.querySelector('head > title')?.textContent?.length, 15); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +--fcc-editable-region-- + + + + + + +--fcc-editable-region-- + + + + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133d11ef548f51f876149e3.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133d11ef548f51f876149e3.md new file mode 100644 index 00000000000..0b88c6167e6 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6133d11ef548f51f876149e3.md @@ -0,0 +1,68 @@ +--- +id: 6133d11ef548f51f876149e3 +title: 步骤 6 +challengeType: 0 +dashedName: step-6 +--- + +# --description-- + +导航是无障碍的核心部分,屏幕阅读器依靠你提供你的页面结构。 这是通过语义 HTML 元素完成的。 + +将 `header` 元素和 `main` 元素添加到你的页面。 + +`header` 元素将用于介绍页面,以及提供导航菜单。 + +`main` 元素将包含页面的核心内容。 + +# --hints-- + +你应该将给 `body` 元素添加一个 `header` 元素。 + +```js +assert.exists(document.querySelector('body > header')); +``` + +你应该给 `body` 元素添加一个 `main` 元素。 + +```js +assert.exists(document.querySelector('body > main')); +``` + +`header` 元素应该在 `main` 元素之前。 + +```js +assert.exists(document.querySelector('header + main')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + +--fcc-editable-region-- + + + +--fcc-editable-region-- + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e2546d0594208229ada50.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e2546d0594208229ada50.md new file mode 100644 index 00000000000..4c87c8ab70b --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e2546d0594208229ada50.md @@ -0,0 +1,93 @@ +--- +id: 613e2546d0594208229ada50 +title: 步骤 7 +challengeType: 0 +dashedName: step-7 +--- + +# --description-- + +在 `header` 中,通过嵌套一个 `img` 元素、`h1` 元素和 `nav` 元素来提供有关页面的上下文。 + +`img` 元素应该指向 `https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg`,并且有一个 `id` 为 `logo`。 + +`h1` 元素应该包含文本 `HTML/CSS Quiz`。 + +# --hints-- + +你应该将 `img` 元素添加到 `header` 元素。 + +```js +assert.exists(document.querySelector('header > img')); +``` + +你应该将 `h1` 元素添加到 `header` 元素。 + +```js +assert.exists(document.querySelector('header > h1')); +``` + +你应该将 `nav` 元素添加到 `header` 元素。 + +```js +assert.exists(document.querySelector('header > nav')); +``` + +你应该按照依次添加 `img` 元素、`h1` 元素和 `nav` 元素。 + +```js +assert.exists(document.querySelector('img + h1 + nav')); +``` + +你应该给 `img` 元素添加一个 `src` 属性,值为 `https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg`。 + +```js +assert.equal(document.querySelector('img')?.src, 'https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg'); +``` + +你应该给 `img` 元素添加一个 `id` 属性,值为 `logo`。 + +```js +assert.equal(document.querySelector('img')?.id, 'logo'); +``` + +你应该给 `h1` 元素添加文本 `HTML/CSS Quiz`。 + +```js +assert.include(document.querySelector('h1')?.innerText?.toLowerCase(), 'html/css quiz'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + + +--fcc-editable-region-- +
+ +
+--fcc-editable-region-- +
+ + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e275749ebd008e74bb62e.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e275749ebd008e74bb62e.md new file mode 100644 index 00000000000..e2064da7b2c --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/613e275749ebd008e74bb62e.md @@ -0,0 +1,66 @@ +--- +id: 613e275749ebd008e74bb62e +title: 步骤 8 +challengeType: 0 +dashedName: step-8 +--- + +# --description-- + +_SVG_(可缩放矢量图形)的一个有用之处是它包含一个 `path` 属性,该属性允许在不影响图像分辨率的情况下缩放图像。 + +`img` 当前是默认尺寸,这个尺寸太大。 可以使用它的 `id` 作为选择器来缩放图像,并将 `width` 设置为 `max(100px, 18vw)`。 + +# --hints-- + +你应该使用 `#logo` 选择器来定位 `img` 元素。 + +```js +assert.exists(new __helpers.CSSHelp(document).getStyle('#logo')); +``` + +你应该给 `img` 元素添加一个值为 `max(100px, 18vw)` 的 `width`。 + +```js +assert.equal(new __helpers.CSSHelp(document).getStyle('#logo')?.width, 'max(100px, 18vw)'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + + +
+ +

HTML/CSS Quiz

+ +
+
+ + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6141fabd6f75610664e908fd.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6141fabd6f75610664e908fd.md new file mode 100644 index 00000000000..8517ad48aff --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/6141fabd6f75610664e908fd.md @@ -0,0 +1,125 @@ +--- +id: 6141fabd6f75610664e908fd +title: 步骤 14 +challengeType: 0 +dashedName: step-14 +--- + +# --description-- + +由于这是一个测试题,你需要给用户提供一个表单以便他们提交答案。 你可以使用 `section` 元素在语义上分隔表单中的内容。 + +在 `main` 元素中,创建一个包含三个嵌套 `section` 元素的表单。 然后,使用正确的方法将表单提交到 `https://freecodecamp.org/practice-project/accessibility-quiz`。 + +# --hints-- + +你应该在 `main` 元素中嵌套一个 `form` 元素。 + +```js +assert.exists(document.querySelector('main > form')); +``` + +你应该在 `form` 元素中嵌套三个 `section` 元素。 + +```js +assert.equal(document.querySelectorAll('main > form > section')?.length, 3); +``` + +你应该给 `form` 元素一个 `action` 属性。 + +```js +assert.notEmpty(document.querySelector('main > form')?.action); +``` + +你应该将 `action` 属性的值设置为 `https://freecodecamp.org/practice-project/accessibility-quiz`。 + +```js +assert.equal(document.querySelector('main > form')?.action, 'https://freecodecamp.org/practice-project/accessibility-quiz'); +``` + +你应该给 `form` 元素一个 `method` 属性。 + +```js +assert.notEmpty(document.querySelector('main > form')?.method); +``` + +你应该给 `form` 元素一个 `method` 属性,其值为 `post`。 + +```js +assert.equal(document.querySelector('main > form')?.method?.toLowerCase(), 'post'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Accessibility Quiz + + + +
+ +

HTML/CSS Quiz

+ +
+--fcc-editable-region-- +
+ +
+--fcc-editable-region-- + + + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} + +header { + width: 100%; + height: 50px; + background-color: #1b1b32; + display: flex; +} + +#logo { + width: max(100px, 18vw); + background-color: #0a0a23; + aspect-ratio: 35 / 4; + padding: 0.4rem; +} + +h1 { + color: #f1be32; + font-size: min(5vw, 1.2em); +} + +nav { + width: 50%; + max-width: 300px; + height: 50px; +} + +nav > ul { + display: flex; + justify-content: space-evenly; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614ccc21ea91ef1736b9b578.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614ccc21ea91ef1736b9b578.md new file mode 100644 index 00000000000..7b4fda53260 --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614ccc21ea91ef1736b9b578.md @@ -0,0 +1,50 @@ +--- +id: 614ccc21ea91ef1736b9b578 +title: 步骤 1 +challengeType: 0 +dashedName: step-1 +--- + +# --description-- + +欢迎来到无障碍测试题的第一部分。 你正在成为一个经验丰富的 HTML 和 CSS 开发者,我们从基本的模板带你开始学习这些知识。 + +通过为你的 `html` 元素添加一个 `lang` 属性来开始这段无障碍之旅。 这将帮助屏幕阅读器识别页面的语言。 + +# --hints-- + +你应该给 `html` 元素一个 `lang` 属性。 _提示:对于英文,你可以使用值 `en` 。_ + +```js +assert.match(code, //i); +// TODO: This should/could be fixed in the builder.js +// assert.notThrow(Intl.getCanonicalLocales(document.querySelector('html').lang)); +``` + +# --seed-- + +## --seed-contents-- + +```html + +--fcc-editable-region-- + + + + + + + + +--fcc-editable-region-- + +``` + +```css +body { + background: #f5f6f7; + color: #1b1b32; + font-family: Helvetica; + margin: 0; +} +``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f33071498eb2472b87ddee4.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f33071498eb2472b87ddee4.md new file mode 100644 index 00000000000..e25f956c7aa --- /dev/null +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f33071498eb2472b87ddee4.md @@ -0,0 +1,43 @@ +--- +id: 5f33071498eb2472b87ddee4 +title: 第1步: +challengeType: 0 +dashedName: step-1 +--- + +# --description-- + +之前在Cat Photo App的最后几个步骤中提过,构建网页前需要一个基本的结构。 + +添加标签 `` 和元素 `html` 。 + +# --hints-- + +需要先声明`DOCTYPE` + +```js +assert(code.match(//i)); +``` + +需要一个起始标签 `` + +```js +assert(code.match(//i)); +``` + +需要一个闭合标签 `` 别忘了闭合标签的尖括号 `<` 后需要有一个 `/` + +```js +assert(code.match(/<\/html>/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md index cdd62359751..9cbd82dc301 100644 --- a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md +++ b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md @@ -1,6 +1,6 @@ --- id: 587d78af367417b2b2512b04 -title: Build a Product Landing Page +title: Costruire la Landing Page per un prodotto challengeType: 14 forumTopicId: 301144 dashedName: build-a-product-landing-page @@ -8,87 +8,87 @@ dashedName: build-a-product-landing-page # --description-- -**Objective:** Build an app that is functionally similar to https://product-landing-page.freecodecamp.rocks +**Obbiettivo:** Crea un'app funzionalmente simile a https://product-landing-page.freecodecamp.rocks -**User Stories:** +**User story:** -1. Your product landing page should have a `header` element with a corresponding `id="header"` -1. You can see an image within the `header` element with a corresponding `id="header-img"` (A logo would make a good image here) -1. Within the `#header` element, you can see a `nav` element with a corresponding `id="nav-bar"` -1. You can see at least three clickable elements inside the `nav` element, each with the class `nav-link` -1. When you click a `.nav-link` button in the `nav` element, you are taken to the corresponding section of the landing page -1. You can watch an embedded product video with `id="video"` -1. Your landing page has a `form` element with a corresponding `id="form"` -1. Within the form, there is an `input` field with `id="email"` where you can enter an email address -1. The `#email` input field should have placeholder text to let users know what the field is for -1. The `#email` input field uses HTML5 validation to confirm that the entered text is an email address -1. Within the form, there is a submit `input` with a corresponding `id="submit"` -1. When you click the `#submit` element, the email is submitted to a static page (use this mock URL: `https://www.freecodecamp.com/email-submit`) -1. The navbar should always be at the top of the viewport -1. Your product landing page should have at least one media query -1. Your product landing page should utilize CSS flexbox at least once +1. La pagina di destinazione del prodotto dovrebbe avere un elemento `header` con un corrispondente `id="header"` +1. Puoi vedere un immagine dentro l'elemento `header` con un attributo corrispondente `id="header-img"` (un logo sarebbe una buona immagine qui) +1. Dentro l'elemento `#header`, puoi vedere un elemento `nav` con un corrispondente attributo `id="nav-bar"` +1. Puoi vedere almeno tre elementi cliccabili dentro l'elemento `nav`, ognuno con una classe di `nav-link` +1. Quando clicchi su un pulsante `.nav-link` dentro l'elemento `nav`, vieni portato alla sezione corrispondente nella pagina +1. Puoi vedere un video sul prodotto incorporato nella pagina con `id="video"` +1. La tua pagina ha un elemento `form` con un corrispondente attributo `id="form"` +1. Dentro il modulo, c'è un campo `input` con un `id="email"` dove puoi inserire un indirizzo email +1. Il campo input `#email` dovrebbe avere testo segnaposto per far sapere agli utenti per che cosa è il campo +1. Il campo input `#email` usa la validazione HTML5 per confermare che il testo inserito è un indirizzo email +1. Dentro il modulo, c'è un `input` per inviare con un corrispondente `id="submit"` +1. Quando clicchi l'elemento `#submit`, l'email è inviata a una pagina statica (usa l'URL non funzionante: `https://www.freecodecamp.com/email-submit`) +1. La barra di navigazione dovrebbe essere sempre in cima alla porta di visualizzazione +1. La tua pagina del prodotto dovrebbe avere almeno un media query +1. La tua pagina del prodotto dovrebbe utilizzare CSS flexbox almeno una volta -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +Soddisfa le storie utente e passa tutti i test qua sotto per completare il progetto. Usa il tuo stile personale. Buon divertimento! # --hints-- -You should have a `header` element with an `id` of `header` +Dovresti avere un elemento `header` con un `id` di `header` ```js const el = document.getElementById('header') assert(!!el && el.tagName === 'HEADER') ``` -You should have an `img` element with an `id` of `header-img` +Dovresti avere un elemento `img` con un attributo `id` di `header-img` ```js const el = document.getElementById('header-img') assert(!!el && el.tagName === 'IMG') ``` -Your `#header-img` should be a descendant of the `#header` +L'elemento `#header-img` dovrebbe essere un discendente di `#header` ```js const els = document.querySelectorAll('#header #header-img') assert(els.length > 0) ``` -Your `#header-img` should have a `src` attribute +L'elemento `#header-img` dovrebbe avere un attributo `src` ```js const el = document.getElementById('header-img') assert(!!el && !!el.src) ``` -Your `#header-img`’s `src` value should be a valid URL (starts with `http`) +L'attributo `src` dell'elemento `#header-img` dovrebbe essere un URL valido (inizia con `http`) ```js const el = document.getElementById('header-img') assert(!!el && /^http/.test(el.src)) ``` -You should have a `nav` element with an `id` of `nav-bar` +Dovresti avere un elemento `nav` con un `id` di `nav-bar` ```js const el = document.getElementById('nav-bar') assert(!!el && el.tagName === 'NAV') ``` -Your `#nav-bar` should be a descendant of the `#header` +Il tuo elemento `#nav-bar` dovrebbe essere un discendente dell'elemento `#header` ```js const els = document.querySelectorAll('#header #nav-bar') assert(els.length > 0) ``` -You should have at least 3 `.nav-link` elements within the `#nav-bar` +Dovresti avere almeno 3 elementi `.nav-link` dentro `#nav-bar` ```js const els = document.querySelectorAll('#nav-bar .nav-link') assert(els.length >= 3) ``` -Each `.nav-link` element should have an `href` attribute +Ogni elemento `.nav-link` dovrebbe avere un attributo `href` ```js const els = document.querySelectorAll('.nav-link') @@ -98,7 +98,7 @@ els.forEach(el => { assert(els.length > 0) ``` -Each `.nav-link` element should link to a corresponding element on the landing page (has an `href` with a value of another element's id. e.g. `#footer`) +Ogni elemento `.nav-link` dovrebbe essere un collegamento ad un elemento corrispondente nella pagina (cioè ha un attributo `href` con il valore dell'id di un altro elemento, ad esempio `#footer`) ```js const els = document.querySelectorAll('.nav-link') @@ -109,91 +109,99 @@ els.forEach(el => { assert(els.length > 0) ``` -You should have a `video` or `iframe` element with an `id` of `video` +Dovresti avere un elemento `video` o `iframe` con un `id` di `video` ```js const el = document.getElementById('video') assert(!!el && (el.tagName === 'VIDEO' || el.tagName === 'IFRAME')) ``` -Your `#video` should have a `src` attribute +L'elemento `#video` dovrebbe avere un attributo `src` ```js -const el = document.getElementById('video') -assert(!!el && !!el.src) +let el = document.getElementById('video') +const sourceNode = el.children; +let sourceElement = null; +if (sourceNode.length) { + sourceElement = [...video.children].filter(el => el.localName === 'source')[0]; +} +if (sourceElement) { + el = sourceElement; +} +assert(el.hasAttribute('src')); ``` -You should have a `form` element with an `id` of `form` +Dovresti avere un elemento `form` con un attributo `id` di `form` ```js const el = document.getElementById('form') assert(!!el && el.tagName === 'FORM') ``` -You should have an `input` element with an `id of `email` +Dovresti avere un elemento `input` con un `id` di `email` ```js const el = document.getElementById('email') assert(!!el && el.tagName === 'INPUT') ``` -Your `#email` should be a descendant of the `#form` +L'elemento `#email` dovrebbe essere un discendente di `#form` ```js const els = document.querySelectorAll('#form #email') assert(els.length > 0) ``` -Your `#email` should have the `placeholder` attribute with placeholder text +L'elemento `#email`dovrebbe avere un attributo `placeholder` con del testo segnaposto ```js const el = document.getElementById('email') assert(!!el && !!el.placeholder && el.placeholder.length > 0) ``` -Your `#email` should use HTML5 validation by setting its `type` to `email` +L'elemento `#email` dovrebbe usare la validazione HTML5 impostando l'attributo `type` a `email` ```js const el = document.getElementById('email') assert(!!el && el.type === 'email') ``` -You should have an `input` element with an `id` of `submit` +Dovresti avere un elemento `input` con un `id` di `submit` ```js const el = document.getElementById('submit') assert(!!el && el.tagName === 'INPUT') ``` -Your `#submit` should be a descendant of the `#form` +L'elemento `#submit` dovrebbe essere un discendente di `#form` ```js const els = document.querySelectorAll('#form #submit') assert(els.length > 0) ``` -Your `#submit` should have a `type` of `submit` +L'elemento `#submit` dovrebbe avere un attributo `type` con valore di `submit` ```js const el = document.getElementById('submit') assert(!!el && el.type === 'submit') ``` -Your `#form` should have an `action` attribute of `https://www.freecodecamp.com/email-submit` +L'elemento `#form` dovrebbe avere un attributo `action` con valore di `https://www.freecodecamp.com/email-submit` ```js const el = document.getElementById('form') assert(!!el && el.action === 'https://www.freecodecamp.com/email-submit') ``` -Your `#email` should have a `name` attribute of `email` +L'elemento `#email` dovrebbe avere un attributo `name` con valore di `email` ```js const el = document.getElementById('email') assert(!!el && el.name === 'email') ``` -Your `#nav-bar` should always be at the top of the viewport +L'elemento `#nav-bar` dovrebbe sempre essere in cima al viewport ```js const el = document.getElementById('nav-bar') @@ -202,13 +210,15 @@ const top2 = el?.offsetTop assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) ``` -Your Product Landing Page should use at least one media query +La pagina dovrebbe avere almeno un media query ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` -Your Product Landing Page should use CSS Flexbox at least once +La tua pagina dovrebbe usare CSS Flexbox almeno una volta ```js const stylesheet = new __helpers.CSSHelp(document).getStyleSheet() diff --git a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.md b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.md index 937c4482c93..79eb105c17d 100644 --- a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.md +++ b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.md @@ -1,6 +1,6 @@ --- id: 587d78af367417b2b2512b03 -title: Build a Survey Form +title: Creare un modulo di sondaggio challengeType: 14 forumTopicId: 301145 dashedName: build-a-survey-form @@ -8,277 +8,277 @@ dashedName: build-a-survey-form # --description-- -**Objective:** Build an app that is functionally similar to https://survey-form.freecodecamp.rocks +**Obbiettivo:** Crea un'app funzionalmente simile a https://survey-form.freecodecamp.rocks -**User Stories:** +**User story:** -1. You should have a page title in an `h1` element with an `id` of `title` -1. You should have a short explanation in a `p` element with an `id` of `description` -1. You should have a `form` element with an `id` of `survey-form` -1. Inside the form element, you are **required** to enter your name in an `input` field that has an `id` of `name` and a `type` of `text` -1. Inside the form element, you are **required** to enter your email in an `input` field that has an `id` of `email` -1. If you enter an email that is not formatted correctly, you will see an HTML5 validation error -1. Inside the form, you can enter a number in an `input` field that has an `id` of `number` -1. If you enter non-numbers in the number input, you will see an HTML5 validation error -1. If you enter numbers outside the range of the number input, which are defined by the `min` and `max` attributes, you will see an HTML5 validation error -1. For the name, email, and number input fields, you can see corresponding `label` elements in the form, that describe the purpose of each field with the following ids: `id="name-label"`, `id="email-label"`, and `id="number-label"` -1. For the name, email, and number input fields, you can see placeholder text that gives a description or instructions for each field -1. Inside the form element, you should have a `select` dropdown element with an `id` of `dropdown` and at least two options to choose from -1. Inside the form element, you can select an option from a group of at least two radio buttons that are grouped using the `name` attribute -1. Inside the form element, you can select several fields from a series of checkboxes, each of which must have a `value` attribute -1. Inside the form element, you are presented with a `textarea` for additional comments -1. Inside the form element, you are presented with a button with `id` of `submit` to submit all the inputs +1. Dovresti avere un titolo di pagina in un elemento `h1` con un attributo `id` di `title` +1. Dovrebbe esserci una breve spiegazione in un elemento `p` con un `id` di `description` +1. Dovrebbe esserci un elemento `form` con un attributo `id` di `survey-form` +1. All'interno dell'elemento modulo, ti è **richiesto** di scrivere il tuo nome in un campo `input` che ha un attributo `id` di `name` e un attributo `type` di `text` +1. All'interno dell'elemento modulo, ti è **richiesto** di inserire la tua email in un campo di `input` che ha un `id` di `email` +1. Se inserisci una mail che non è formattata correttamente, vedrai un errore di validazione HTML5 +1. All'interno del modulo è possibile inserire un numero in un campo `input` che ha un `id` di `number` +1. Se entri non-numeri nell'input di numero, vedrai un errore di validazione HTML5 +1. Se immetti un numero al di fuori del range del campo per il numero, che hai definito con gli attributi `min` e `max`, vedrai un errore di validazione HTML5 +1. Per le caselle di input per il nome, la mail e il numero, puoi vedere dei corrispondenti elementi `label` nel modulo che descrivono lo scopo di ogni campo con i seguenti attributi id: `id="name-label"`, `id="email-label"`, e `id="number-label"` +1. Per i campi di input del nome, mail e numero, puoi vedere del testo segnaposto che da una descrizione o istruzioni per ogni campo +1. Dentro l'elemento modulo, dovresti vedere un elemento `select` a tendina con un `id` di `dropdown` e almeno due opzioni tra cui scegliere +1. Dentro l'elemento modulo, puoi selezionare una opzione da un gruppo di almeno due elementi radio che sono raggruppati con l'attributo `name` +1. All'interno dell'elemento del modulo, è possibile selezionare diversi campi da una serie di caselle di controllo, ciascuno dei quali deve avere un attributo `value` +1. All'interno del modulo, ti è presentato un elemento `textarea` per commenti aggiuntivi +1. Dentro l'elemento modulo, puoi vedere un pulsante con un `id` di `submit` per inviare tutti gli input -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +Soddisfa le user story e passa tutti i test qua sotto per complerare questo progetto. Usa il tuo stile personale. Buon divertimento! # --hints-- -You should have an `h1` element with an `id` of `title` +Dovrebbe esserci un elemento `h1` con un `id` di `title` ```js const el = document.getElementById('title') assert(!!el && el.tagName === 'H1') ``` -Your `#title` should not be empty +Il tuo elemento `#title` non dovrebbe essere vuoto ```js const el = document.getElementById('title') assert(!!el && el.innerText.length > 0) ``` -You should have a `p` element with an `id` of `description` +Dovrebbe esserci un elemento `p` con un `id` di `description` ```js const el = document.getElementById('description') assert(!!el && el.tagName === 'P') ``` -Your `#description` should not be empty +L'elemento `#description` non dovrebbe essere vuoto ```js const el = document.getElementById('description') assert(!!el && el.innerText.length > 0) ``` -You should have a `form` element with an `id` of `survey-form` +Dovrebbe esserci un elemento `form` con un attributo `id` di `survey-form` ```js const el = document.getElementById('survey-form') assert(!!el && el.tagName === 'FORM') ``` -You should have an `input` element with an `id` of `name` +Dovresti avere un elemento `input` con un `id` di `name` ```js const el = document.getElementById('name') assert(!!el && el.tagName === 'INPUT') ``` -Your `#name` should have a `type` of `text` +L'elemento `#name` dovrebbe avere un attributo `type` con valore di `text` ```js const el = document.getElementById('name') assert(!!el && el.type === 'text') ``` -Your `#name` should require input +L'elemento `#name` dovrebbe richiedere un input ```js const el = document.getElementById('name') assert(!!el && el.required) ``` -Your `#name` should be a descedant of `#survey-form` +L'elemento `#name` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #name') assert(!!el) ``` -You should have an `input` element with an `id` of `email` +Dovresti avere un elemento `input` con un `id` di `email` ```js const el = document.getElementById('email') assert(!!el && el.tagName === 'INPUT') ``` -Your `#email` should have a `type` of `email` +L'elemento `#email` dovrebbe avere un attributo `type` con valore di `email` ```js const el = document.getElementById('email') assert(!!el && el.type === 'email') ``` -Your `#email` should require input +L'elemento `#email` dovrebbe richiedere un input ```js const el = document.getElementById('email') assert(!!el && el.required) ``` -Your `#email` should be a descedant of `#survey-form` +L'elemento `#email` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #email') assert(!!el) ``` -You should have an `input` element with an `id` of `number` +Dovresti avere un elemento `input` con un `id` di `number` ```js const el = document.getElementById('number') assert(!!el && el.tagName === 'INPUT') ``` -Your `#number` should be a descedant of `#survey-form` +L'elemento `#number` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #number') assert(!!el) ``` -Your `#number` should have a `type` of `number` +L'elemento `#number` dovrebbe avere un attributo `type` con valore di `number` ```js const el = document.getElementById('number') assert(!!el && el.type === 'number') ``` -Your `#number` should have a `min` attribute with a numeric value +L'elemento `#number` dovrebbe avere un attributo `min` con un valore numerico ```js const el = document.getElementById('number') assert(!!el && el.min && isFinite(el.min)) ``` -Your `#number` should have a `max` attribute with a numeric value +L'elemento `#number` dovrebbe avere un attributo `max` con un valore numerico ```js const el = document.getElementById('number') assert(!!el && el.max && isFinite(el.max)) ``` -You should have a `label` element with an `id` of `name-label` +Dovresti avere un elemento `label` con un `id` di `name-label` ```js const el = document.getElementById('name-label') assert(!!el && el.tagName === 'LABEL') ``` -You should have a `label` element with an `id` of `email-label` +Dovresti avere un elemento `label` con un `id` di `email-label` ```js const el = document.getElementById('email-label') assert(!!el && el.tagName === 'LABEL') ``` -You should have a `label` element with an `id` of `number-label` +Dovresti avere un elemento `label` con un `id` di `number-label` ```js const el = document.getElementById('number-label') assert(!!el && el.tagName === 'LABEL') ``` -Your `#name-label` should not be empty +L'elemento `#name-label` non dovrebbe essere vuoto ```js const el = document.getElementById('name-label') assert(!!el && el.innerText.length > 0) ``` -Your `#email-label` should not be empty +L'elemento `#email-label` non dovrebbe essere vuoto ```js const el = document.getElementById('email-label') assert(!!el && el.innerText.length > 0) ``` -Your `#number-label` should not be empty +L'elemento `#number-label` non dovrebbe essere vuoto ```js const el = document.getElementById('number-label') assert(!!el && el.innerText.length > 0) ``` -Your `#name-label` should be a descedant of `#survey-form` +L'elemento `#name-label` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #name-label') assert(!!el) ``` -Your `#email-label` should be a descedant of `#survey-form` +L'elemento `#email-label` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #email-label') assert(!!el) ``` -Your `#number-label` should be a descedant of `#survey-form` +L'elemento `#number-label` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #number-label') assert(!!el) ``` -Your `#name` should have a `placeholder` attribute and value +L'elemento `#name` dovrebbe avere un attributo `placeholder` con un valore ```js const el = document.getElementById('name') assert(!!el && !!el.placeholder && el.placeholder.length > 0) ``` -Your `#email` should have a `placeholder` attribute and value +L'elemento `#email` dovrebbe avere un attributo `placeholder` con un valore ```js const el = document.getElementById('email') assert(!!el && !!el.placeholder && el.placeholder.length > 0) ``` -Your `#number` should have a `placeholder` attribute and value +L'elemento `#number` dovrebbe avere un attributo `placeholder` con un valore ```js const el = document.getElementById('number') assert(!!el && !!el.placeholder && el.placeholder.length > 0) ``` -You should have a `select` field with an `id` of `dropdown` +Dovrebbe esserci un campo `select` con un `id` di `dropdown` ```js const el = document.getElementById('dropdown') assert(!!el && el.tagName === 'SELECT') ``` -Your `#dropdown` should have at least two selectable (not disabled) `option` elements +L'elemento `#dropdown` dovrebbe avere almeno due elementi `option` selezionabili (non disattivati) ```js const els = document.querySelectorAll('#dropdown option:not([disabled])') assert(els.length >= 2) ``` -Your `#dropdown` should be a descendant of `#survey-form` +L'elemento `#dropdown` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #dropdown') assert(!!el) ``` -You should have at least two `input` elements with a `type` of `radio` (radio buttons) +Dovresti avere almeno due elementi `input` con un attributo `type` di `radio` (pulsanti radio) ```js const els = document.querySelectorAll('input[type="radio"]') assert(els.length >= 2) ``` -You should have at least two radio buttons that are descendants of `#survey-form` +Dovresti avere almeno due pulsanti radio che sono discendenti di `#survey-form` ```js const els = document.querySelectorAll('#survey-form input[type="radio"]') assert(els.length >= 2) ``` -All your radio buttons should have a `value` attribute and value +Tutti i tuoi pulsanti radio dovrebbero avere un attributo `value` con un valore ```js const els1 = document.querySelectorAll('input[type="radio"]') @@ -286,7 +286,7 @@ const els2 = document.querySelectorAll('input[type="radio"][value=""], input[typ assert(els1.length > 0 && els2.length === 0) ``` -All your radio buttons should have a `name` attribute and value +Tutti i tuoi pulsanti radio dovrebbero avere un attributo `name` con un valore ```js const els1 = document.querySelectorAll('input[type="radio"]') @@ -294,7 +294,7 @@ const els2 = document.querySelectorAll('input[type="radio"][name=""], input[type assert(els1.length > 0 && els2.length === 0) ``` -Every radio button group should have at least 2 radio buttons +Ogni gruppo di pulsanti radio dovrebbe avere almeno 2 pulsanti radio ```js const radioButtons = document.querySelectorAll('input[type="radio"]'); @@ -316,14 +316,14 @@ groupKeys.forEach(key => { assert(groupKeys.length > 0) ``` -You should have at least two `input` elements with a `type` of `checkbox` (checkboxes) that are descendants of `#survey-form` +Dovresti avere almeno due elementi `input` con un attributo `type` di `checkbox` (caselle a scelta multipla) che sono discendenti di `#survey-form` ```js const els = document.querySelectorAll('#survey-form input[type="checkbox"]'); assert(els.length >= 2) ``` -All your checkboxes inside `#survey-form` should have a `value` attribute and value +Tutte le tue caselle checkbox dentro l'elemento `#survey-form` dovrebbero avere un attributo `value` con un valore ```js const els1 = document.querySelectorAll('#survey-form input[type="checkbox"]') @@ -331,28 +331,28 @@ const els2 = document.querySelectorAll('#survey-form input[type="checkbox"][valu assert(els1.length > 0 && els2.length === 0) ``` -You should have at least one `textarea` element that is a descendant of `#survey-form` +Dovrebbe esserci almeno un elemento `textarea` discendente di `#survey-form` ```js const el = document.querySelector('#survey-form textarea') assert(!!el) ``` -You should have an `input` or `button` element with an `id` of `submit` +Dovrebbe esserci un elemento `input` o `button` con un `id` di `submit` ```js const el = document.getElementById('submit') assert(!!el && (el.tagName === 'INPUT' || el.tagName === 'BUTTON')) ``` -Your `#submit` should have a `type` of `submit` +L'elemento `#submit` dovrebbe avere un attributo `type` con valore di `submit` ```js const el = document.getElementById('submit') assert(!!el && el.type === 'submit') ``` -Your `#submit` should be a descendant of `#survey-form` +L'elemento `#submit` dovrebbe essere un discendente di `#survey-form` ```js const el = document.querySelector('#survey-form #submit') diff --git a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md index 6c433375ba7..7a6cab0f04e 100644 --- a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md +++ b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md @@ -1,6 +1,6 @@ --- id: 587d78b0367417b2b2512b05 -title: Build a Technical Documentation Page +title: Creare una pagina di documentazione tecnica challengeType: 14 forumTopicId: 301146 dashedName: build-a-technical-documentation-page @@ -8,45 +8,45 @@ dashedName: build-a-technical-documentation-page # --description-- -**Objective:** Build an app that is functionally similar to https://technical-documentation-page.freecodecamp.rocks +**Obbiettivo:** Crea un'app funzionalmente simile a https://technical-documentation-page.freecodecamp.rocks -**User Stories:** +**User story:** -1. You can see a `main` element with a corresponding `id="main-doc"`, which contains the page's main content (technical documentation) -1. Within the `#main-doc` element, you can see several `section` elements, each with a class of `main-section`. There should be a minimum of five -1. The first element within each `.main-section` should be a `header` element, which contains text that describes the topic of that section. -1. Each `section` element with the class of `main-section` should also have an `id` that corresponds with the text of each `header` contained within it. Any spaces should be replaced with underscores (e.g. The section that contains the header "JavaScript and Java" should have a corresponding `id="JavaScript_and_Java"`) -1. The `.main-section` elements should contain at least ten `p` elements total (not each) -1. The `.main-section` elements should contain at least five `code` elements total (not each) -1. The `.main-section` elements should contain at least five `li` items total (not each) -1. You can see a `nav` element with a corresponding `id="navbar"` -1. The navbar element should contain one `header` element which contains text that describes the topic of the technical documentation -1. Additionally, the navbar should contain link (`a`) elements with the class of `nav-link`. There should be one for every element with the class `main-section` -1. The `header` element in the `#navbar` must come before any link (`a`) elements in the navbar -1. Each element with the class of `nav-link` should contain text that corresponds to the `header` text within each `section` (e.g. if you have a "Hello world" section/header, your navbar should have an element which contains the text "Hello world") -1. When you click on a navbar element, the page should navigate to the corresponding section of the `main-doc` element (e.g. If you click on a `nav-link` element that contains the text "Hello world", the page navigates to a `section` element with that id, and contains the corresponding header) -1. On regular sized devices (laptops, desktops), the element with `id="navbar"` should be shown on the left side of the screen and should always be visible to the user -1. Your technical documentation should use at least one media query +1. Puoi vedere un elemento `main` con un corrispondente `id="main-doc"`, che contiene il contenuto principale della pagina (documentazione tecnica) +1. Dentro l'elemento `#main-doc`, puoi vedere svariati elementi `section`, ognuno con una classe di `main-section`. Dovrebbero esserne almeno cinque +1. Il primo elemento dentro ogni `.main-section` dovrebbe essere un elemento `header`, che contiene testo che descrive l'argomento della sezione. +1. Ogni elemento `section` con una classe di `main-section` dovrebbe avere un `id` che corrisponde al testo di ogni elemento `header` al suo interno. Qualsiasi spazio deve essere sostituito con un underscore (ad es. La sezione section che contiene l'intestazione "JavaScript e Java" dovrebbe avere un corrispondente `id="JavaScript_and_Java"`) +1. Gli elementi `.main-section` dovrebbero contenere almeno dieci elementi `p` in totale (non ognuno) +1. Gli elementi `.main-section` dovrebbero contenere almeno cinque elementi `code` in totale (non ognuno) +1. Gli elementi `.main-section` dovrebbero contenere almeno cinque elementi `li` in totale (non ognuno) +1. Puoi vedere un elemento `nav` con un corrispondente `id="navbar"` +1. L'elemento barra di navigazione dovrebbe contenere un elemento `header` che contiene del testo che descrive l'argomento della documentazione tecnica +1. In aggiunta, la barra di navigazione dovrebbe contenere dei link (elementi `a`) con la classe di `nav-link`. Dovrebbe essercene uno per ogni elemento di classe `main-section` +1. L'elemento `header` dentro `#navbar` deve venire prima di qualsiasi link (elemento `a`) nella barra di navigazione +1. Ogni elemento con la classe `nav-link` dovrebbe contenere del testo che corrisponde al testo dell'elemento `header` dentro ogni elemento `section` (per esempio, se c'è una sezione/intestazione "Hello world", la barra di navigazione dovrebbe avere un elemento che contiene il testo "Hello world") +1. Quando clicchi su un elemento della barra di navigazione, la pagina dovrebbe navigare alla sezione corrispondente dell'elemento `#main-doc` (per esempio se clicchi su un elemento `.nav-link` che contiene il testo "Hello world", la pagina naviga all'elemento `section` che ha quell'id, e contiene l'intestazione corrispondente) +1. Su dispositivi di dimensione regolare (laptop, desktop), l'elemeneto con `id="navbar"` dovrebbe essere sempre mostrato nella parte destra dello schermo e dovrebbe essere sempre visibile all'utente +1. La tua documentazione tecnica dovrebbe usare almeno un media query -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +Soddisfa le user story e passa tutti i test qua sotto per complerare questo progetto. Usa il tuo stile personale. Buon divertimento! # --hints-- -You should have a `main` element with an `id` of `main-doc` +Dovresti avere un elemento `main` con un `id` di `main-doc` ```js const el = document.getElementById('main-doc') assert(!!el) ``` -You should have at least five `section` elements with a class of `main-section` +Dovresti avere almeno cinque elementi `section` con una classe di `main-section` ```js const els = document.querySelectorAll('#main-doc section') assert(els.length >= 5) ``` -All of your `.main-section` elements should be `section` elements +Tutti gli elementi `.main-section` dovrebbero essere elementi `section` ```js const els = document.querySelectorAll('.main-section') @@ -56,14 +56,14 @@ els.forEach(el => { assert(els.length > 0) ``` -You should have at least five `.main-section` elements that are descendants of `#main-doc` +Dovrebbero esserci almeno cinque elementi `.main-section` che sono discendenti di `#main-doc` ```js const els = document.querySelectorAll('#main-doc .main-section') assert(els.length >= 5) ``` -The first child of each `.main-section` should be a `header` element +Il primo figlio di ogni elemento `.main-section` dovrebbe essere un elemento `header` ```js const els = document.querySelectorAll('.main-section') @@ -73,7 +73,7 @@ els.forEach(el => { assert(els.length > 0) ``` -None of your `header` elements should be empty +Non dovrebbe esserci nessun elemento `header` che sia vuoto ```js const els = document.querySelectorAll('header') @@ -83,7 +83,7 @@ els.forEach(el => { assert(els.length > 0) ``` -All of your `.main-section` elements should have an `id` +Tutti gli elementi `.main-section` dovrebbero avere un `id` ```js const els = document.querySelectorAll('.main-section') @@ -93,7 +93,7 @@ els.forEach(el => { assert(els.length > 0) ``` -Each `.main-section` should have an `id` that matches the text of its first child, having any spaces in the child's text replaced with underscores (`_`) for the id’s +Ogni elemento `.main-section` dovrebbe avere un `id` che corrisponde con il testo del primo figlio, sostituendo ogni spazio nel testo del figlio con i trattini bassi (`_`) ```js const els = document.querySelectorAll('.main-section') @@ -104,49 +104,49 @@ els.forEach(el => { assert(els.length > 0) ``` -You should have at least 10 `p` elements (total) within your `.main-section` elements +Dovresti avere almeno 10 elementi `p` (in totale) dentro i tuoi elementi `.main-section` ```js const els = document.querySelectorAll('.main-section p') assert(els.length >= 10) ``` -You should have at least five `code` elements that are descendants of `.main-section` elements +Dovresti avere almeno cinque elementi `code` che sono discendenti degli elementi `.main-section` ```js const els = document.querySelectorAll('.main-section code') assert(els.length >= 5) ``` -You should have at least five `li` elements that are descendants of `.main-section` elements +Dovrebbero esserci almeno cinque elementi `li` che sono discendenti degli elementi `.main-section` ```js const els = document.querySelectorAll('.main-section li') assert(els.length >= 5) ``` -You should have a `nav` element with an `id` of `navbar` +Dovrebbe esserci un elemento `nav` con un attributo `id` con valore di `navbar` ```js const el = document.getElementById('navbar') assert(!!el && el.tagName === 'NAV') ``` -Your `#navbar` should have exactly one `header` element within it +L'elemento `#navbar` dovrebbe avere un solo elemento `header` dentro di esso ```js const els = document.querySelectorAll('#navbar header') assert(els.length === 1) ``` -You should have at least one `a` element with a class of `nav-link` +Dovrebbe esserci almeno un elemento `a` con una classe di `nav-link` ```js const els = document.querySelectorAll('a[class="nav-link"]') assert(els.length >= 1) ``` -All of your `.nav-link` elements should be anchor (`a`) elements +Tutti gli elementi `.nav-link` dovrebbero essere elementi di ancoraggio (`a`) ```js const els = document.querySelectorAll('.nav-link') @@ -156,7 +156,7 @@ els.forEach(el => { assert(els.length > 0) ``` -All of your `.nav-link` elements should be in the `#navbar` +Tutti gli elementi `.nav-link` dovrebbero essere dentro `#navbar` ```js const els1 = document.querySelectorAll('.nav-link') @@ -164,7 +164,7 @@ const els2 = document.querySelectorAll('#navbar .nav-link') assert(els2.length > 0 && els1.length === els2.length) ``` -You should have the same number of `.nav-link` and `.main-section` elements +Dovresti avere lo stesso numero di elementi `.nav-link` e di elementi `.main-section` ```js const els1 = document.querySelectorAll('.main-section') @@ -172,7 +172,7 @@ const els2 = document.querySelectorAll('.nav-link') assert(els1.length > 0 && els2.length > 0 && els1.length === els2.length) ``` -The `header` element in the `#navbar` should come before any link (`a`) elements also in the `#navbar` +L'elemento `header` dentro `#navbar` dovrebbe venire prima di qualsiasi elemento link (`a`) che si trova dentro `#navbar` ```js const navLinks = document.querySelectorAll('#navbar a.nav-link'); @@ -188,7 +188,7 @@ navLinks.forEach((navLink) => { assert(!!header) ``` -Each `.nav-link` should have text that corresponds to the `header` text of its related `section` (e.g. if you have a "Hello world" section/header, your `#navbar` should have a `.nav-link` which has the text "Hello world") +Ogni elemento `.nav-link` dovrebbe avere del testo che corrisponde all'elemento `header` del relativo elemento `section` (per esempio, se hai una sezione/intestazione con "Hello world", l'elemento `#navbar` dovrebbe avere un elemento `.nav-link` con il testo "Hello world") ```js const headerText = Array.from(document.querySelectorAll('.main-section')).map(el => @@ -201,7 +201,7 @@ const remainder = headerText.filter(str => linkText.indexOf(str) === -1) assert(headerText.length > 0 && headerText.length > 0 && remainder.length === 0) ``` -Each `.nav-link` should have an `href` attribute that links to its corresponding `.main-section` (e.g. If you click on a `.nav-link` element that contains the text "Hello world", the page navigates to a `section` element with that id) +Ogni elemento `.nav-link` dovrebbe avere un attributo `href` che linca all'elemento `.main-section` corrispondente (per esempio, se clicchi su un elemento `.nav-link` che contiene il testo "Hello world", la pagina naviga all'elemento `section` con quell'id) ```js const hrefValues = Array.from(document.querySelectorAll('.nav-link')).map(el => el.getAttribute('href')) @@ -210,7 +210,7 @@ const missingHrefValues = mainSectionIDs.filter(str => hrefValues.indexOf('#' + assert(hrefValues.length > 0 && mainSectionIDs.length > 0 && missingHrefValues.length === 0) ``` -Your `#navbar` should always be on the left edge of the window +L'elemento `#navbar` dovrebbe sempre essere sul bordo sinistro della finestra ```js const el = document.getElementById('navbar') @@ -219,10 +219,12 @@ const left2 = el?.offsetLeft assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) ``` -Your Technical Documentation project should use at least one media query +Il progetto di documentazione tecnica dovrebbe usare almeno un media query ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md index 231292b4373..a28198a65a6 100644 --- a/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md +++ b/curriculum/challenges/italian/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.md @@ -1,6 +1,6 @@ --- id: bd7158d8c442eddfaeb5bd18 -title: Build a Tribute Page +title: Costruire una pagina di tributo challengeType: 14 forumTopicId: 301147 dashedName: build-a-tribute-page @@ -8,32 +8,32 @@ dashedName: build-a-tribute-page # --description-- -**Objective:** Build an app that is functionally similar to https://tribute-page.freecodecamp.rocks +**Obbiettivo:** Crea un'app funzionalmente simile a https://tribute-page.freecodecamp.rocks -**User Stories:** +**User story:** -1. Your tribute page should have an element with a corresponding `id="main"`, which contains all other elements -1. You should see an element with an `id` of `title`, which contains a string (i.e. text), that describes the subject of the tribute page (e.g. "Dr. Norman Borlaug") -1. You should see either a `figure` or a `div` element with an `id` of `img-div` -1. Within the `img-div` element, you should see an `img` element with a corresponding `id="image"` -1. Within the `img-div` element, you should see an element with a corresponding `id="img-caption"` that contains textual content describing the image shown in `img-div` -1. You should see an element with a corresponding `id="tribute-info"`, which contains textual content describing the subject of the tribute page -1. You should see an a element with a corresponding `id="tribute-link"`, which links to an outside site, that contains additional information about the subject of the tribute page. HINT: You must give your element an attribute of `target` and set it to `_blank` in order for your link to open in a new tab -1. Your `#image` should use `max-width` and `height` properties to resize responsively, relative to the width of its parent element, without exceeding its original size -1. Your `img` element should be centered within its parent element +1. La pagina di tributo dovrebbe avere un elemento con un corrispondente `id="main"` che contiene tutti gli altri elementi +1. Dovresti vedere un elemento con un attributo `id` di `title`, che contiene una stringa (cioè del testo) che descrive il soggetto della pagina di tributo (per esempio "Dr. Normal Borlaug") +1. Dovresti vedere o un elemento `figure` o un elemento `div` con un attributo `id` di `img-div` +1. Dentro l'elemento `img-div`, dovresti vedere un elemento `img` con un corrispondente `id="image"` +1. Dentro l'elemento `img-div`, dovresti vedere un elemento con un corrispondente attributo `id="img-caption"` che contiene contenuto testuale che descrive l'immagine mostrata in `img-div` +1. Dovresti vedere un elemento con un corrispondente attributo `id="tribute-info"` che contiene contenuto testuale descrivente il soggetto della pagina tributo +1. Dovresti vedere un elemento con un corrispondente attributo `id="tribute-link"` che linka ad un sito esterno che contiene informazioni aggiuntive sul soggetto della pagina tributo. Suggerimento: Devi dare al tuo elemento un attributo `target` e impostarlo a `_blank` per far si che il link apra in una scheda nuova +1. Il tio elemento `#image` dovrebbe usare le proprietà `max-width` e `height` per ridimensionarsi in maniera responsiva, relativa alla larghezza dell'elemento genitore senza eccedere la dimensione originale +1. Il tuo elemento `img` dovrebbe essere centrato dentro il suo elemento genitore -Fulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding! +Soddisfa le user story e passa tutti i test qua sotto per complerare questo progetto. Usa il tuo stile personale. Buon divertimento! # --hints-- -You should have a `main` element with an `id` of `main` +Dovrebbe esserci un elemento `main` con un `id` di `main` ```js const el = document.getElementById('main') assert(!!el && el.tagName === 'MAIN') ``` -Your `#img-div`, `#image`, `#img-caption`, `#tribute-info`, and `#tribute-link` should all be descendants of `#main` +Gli elementi `#img-div`, `#image`, `#img-caption`, `#tribute-info`, e `#tribute-link` dovrebbero essere tutti discendenti di `#main` ```js const el1 = document.querySelector('#main #img-div') @@ -44,14 +44,14 @@ const el5 = document.querySelector('#main #tribute-link') assert(!!el1 & !!el2 && !!el3 && !!el4 && !!el5) ``` -You should have an element with an `id` of `title` +Dovresti avere un elemento con un attributo `id` avente valore di `title` ```js const el = document.getElementById('title') assert(!!el) ``` -Your `#title` should not be empty +Il tuo elemento `#title` non dovrebbe essere vuoto ```js const el = document.getElementById('title') @@ -59,120 +59,116 @@ assert(!!el && el.innerText.length > 0) ``` -You should have a `figure` or `div` element with an `id` of `img-div` +Dovrebbe esserci o un elemento `figure` o un elemento `div` con un attributo `id` di `img-div` ```js const el = document.getElementById('img-div') assert(!!el && (el.tagName === 'DIV' || el.tagName === 'FIGURE')) ``` -You should have an `img` element with an `id` of `image` +Dovrebbe esserci un elemento `img` con un `id` di `image` ```js const el = document.getElementById('image') assert(!!el && el.tagName === 'IMG') ``` -Your `#image` should be a descendant of `#img-div` +Il tuo elemento `#image` dovrebbe essere un discendente di `#img-div` ```js const el = document.querySelector('#img-div #image') assert(!!el) ``` -You should have a `figcaption` or `div` element with an `id` of `img-caption` +Dovrebbe esserci o un elemento `figcaption` o un elemento `div` con un attributo `id` di `img-caption` ```js const el = document.getElementById('img-caption') assert(!!el && (el.tagName === 'DIV' || el.tagName === 'FIGCAPTION')) ``` -Your `#img-caption` should be a descendant of `#img-div` +L'elemento `#img-caption` dovrebbe essere un discendente di `#img-div` ```js const el = document.querySelector('#img-div #img-caption') assert(!!el) ``` -Your `#img-caption` should not be empty +L'elemento `#img-caption` non dovrebbe essere vuoto ```js const el = document.getElementById('img-caption') assert(!!el && el.innerText.length > 0) ``` -You should have an element with an `id` of `tribute-info` +Dovrevve esserci un elemento con un attributo `id` di `tribute-info` ```js const el = document.getElementById('tribute-info') assert(!!el) ``` -Your `#tribute-info` should not be empty +L'elemento `#tribute-info` non dovrebbe essere vuoto ```js const el = document.getElementById('tribute-info') assert(!!el && el.innerText.length > 0) ``` -You should have an `a` element with an `id` of `tribute-link` +Dovrebbe esserci un elemento `a` con un `id` di `tribute-link` ```js const el = document.getElementById('tribute-link') assert(!!el && el.tagName === 'A') ``` -Your `#tribute-link` should have an `href` attribute and value +L'elemento `#tribute-link` dovrebbe avere un attributo `href` con un valore ```js const el = document.getElementById('tribute-link') assert(!!el && !!el.href && el.href.length > 0) ``` -Your `#tribute-link` should have a `target` attribute set to `_blank` +L'elemento `#tribute-link` dovrebbe avere un attributo `target` di `_blank` ```js const el = document.getElementById('tribute-link') assert(!!el && el.target === '_blank') ``` -You should use an `#image` selector in your CSS to style the `#image` and pass the next three tests +Il tuo elemento `img` dovrebbe avere una proprietà `display` di `block` ```js -const style = new __helpers.CSSHelp(document).getStyle('#image') -assert(!!style) -``` - -Your `#image` should have a `display` of `block` - -```js -const style = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('display') +const img = document.getElementById('image'); +const imgStyle = window.getComputedStyle(img); +const style = imgStyle?.getPropertyValue('display') assert(style === 'block') ``` -Your `#image` should have a `max-width` of `100%` +`#image` dovrebbe avere una proprietà `max-width` di `100%` ```js -const style = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('max-width') +const img = document.getElementById('image'); +const imgStyle = window.getComputedStyle(img); +const style = imgStyle?.getPropertyValue('max-width') assert(style === '100%') ``` -Your `#image` should have a `height` of `auto` +`#image` dovrebbe avere una proprietà `height` di `auto` ```js // taken from the testable-projects repo const img = document.getElementById('image'); -const maxWidthValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('max-width') -const displayValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('display') -const oldDisplayValue = img?.style.getPropertyValue('display'); -const oldDisplayPriority = img?.style.getPropertyPriority('display'); +const imgStyle = window.getComputedStyle(img); +const oldDisplayValue = imgStyle.getPropertyValue('display'); +const oldDisplayPriority = imgStyle.getPropertyPriority('display'); img?.style.setProperty('display', 'none', 'important'); -const heightValue = new __helpers.CSSHelp(document).getStyle('#image')?.getPropertyValue('height') +const heightValue = imgStyle?.getPropertyValue('height') img?.style.setProperty('display', oldDisplayValue, oldDisplayPriority); assert(heightValue === 'auto') ``` -Your `#image` should be centered within its parent +L'elemento `#image` dovrebbe essere centrato dentro l'elemento genitore ```js // taken from the testable-projects repo diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 92ee5db13f9..368f71db799 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -17,19 +17,19 @@ Inizializza le tre variabili `a`, `b` e `c` con `5`, `10`, e `"I am a"` rispetti # --hints-- -`a` dovrebbe essere definito e avere il valore `6`. +La variabile `a` dovrebbe essere definita e avere un valore finale di `6`. ```js assert(typeof a === 'number' && a === 6); ``` -`b` dovrebbe essere definito e avere il valore `15`. +La variabile `b` dovrebbe essere definita e avere un valore finale di `15`. ```js assert(typeof b === 'number' && b === 15); ``` -`c` non dovrebbe contenere `undefined` e dovrebbe avere un valore stringa `I am a String!` +`c` non dovrebbe contenere `undefined` e dovrebbe avere un valore finale della stringa `I am a String!` ```js assert(!/undefined/.test(c) && c === 'I am a String!'); diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md index 2ebbc5d2e15..d61c290817f 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/perform-a-subset-check-on-two-sets-of-data.md @@ -25,7 +25,7 @@ assert( ); ``` -Il primo `Set` dovrebbe essere contenuto nel secondo `Set` +Il primo `Set` dovrebbe essere contenuto nel secondo `Set`. ```js assert( @@ -43,7 +43,7 @@ assert( ); ``` -`['a', 'b'].isSubsetOf(['a', 'b', 'c', 'd'])` dovrebbe restituire `true` +`['a', 'b'].isSubsetOf(['a', 'b', 'c', 'd'])` dovrebbe restituire `true`. ```js assert( @@ -62,7 +62,7 @@ assert( ); ``` -`['a', 'b', 'c'].isSubsetOf(['a', 'b'])` dovrebbe restituire `false` +`['a', 'b', 'c'].isSubsetOf(['a', 'b'])` dovrebbe restituire `false`. ```js assert( @@ -80,7 +80,7 @@ assert( ); ``` -`[].isSubsetOf([])` dovrebbe restituire `true` +`[].isSubsetOf([])` dovrebbe restituire `true`. ```js assert( @@ -93,7 +93,7 @@ assert( ); ``` -`['a', 'b'].isSubsetOf(['c', 'd'])` dovrebbe restituire `false` +`['a', 'b'].isSubsetOf(['c', 'd'])` dovrebbe restituire `false`. ```js assert( diff --git a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-421-prime-factors-of-n151.md b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-421-prime-factors-of-n151.md index 33eedf3507f..b2020b0d7d9 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-421-prime-factors-of-n151.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-421-prime-factors-of-n151.md @@ -1,6 +1,6 @@ --- id: 5900f5131000cf542c510024 -title: 'Problema 421: fattori primi di n15+1' +title: 'Problema 421: fattori primi di n^15+1' challengeType: 5 forumTopicId: 302091 dashedName: problem-421-prime-factors-of-n151 diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md new file mode 100644 index 00000000000..6c98c6184f2 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md @@ -0,0 +1,62 @@ +--- +id: 5f332a88dc25a0fd25c7687a +title: Step 6 +challengeType: 0 +dashedName: step-6 +--- + +# --description-- + +Per far sapere ai visitatori che il bar è stato fondato nel 2020, aggiungi un elemento `p` sotto l'elemento `h1` con il testo `Est. 2020`. + +# --hints-- + +Dovresti avere un tag di apertura `

`. + +```js +assert(code.match(/

/i)); +``` + +Dovresti avere un tag di chiusura `

`. + +```js +assert(code.match(/<\/p>/i)); +``` + +Non dovresti modificare l'elemento `h1` già esistente. Assicurati di non aver eliminato il tag di chiusura. + +```js +assert($('h1').length === 1); +``` + +L'elemento `p` dovrebbe trovarsi sotto l'elemento `h1`. + +```js +assert($('p')[0].previousElementSibling.tagName === 'H1'); +``` + +L'elemento `p` dovrebbe avere il testo `Est. 2020`. + +```js +assert(code.match(/

Est. 2020<\/p>/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Cafe Menu + + +--fcc-editable-region-- +

CAMPER CAFE

+--fcc-editable-region-- + + +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344f9c805cd193c33d829c.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344f9c805cd193c33d829c.md new file mode 100644 index 00000000000..adfd9aeb31f --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344f9c805cd193c33d829c.md @@ -0,0 +1,71 @@ +--- +id: 5f344f9c805cd193c33d829c +title: Step 12 +challengeType: 0 +dashedName: step-12 +--- + +# --description-- + +Puoi aggiungere uno stile a un elemento specificandolo nell'elemento `style` e impostando una proprietà in questo modo: + +```css +element { + property: value; +} +``` + +Centra l'elemento `h1` assegnando alla proprietà `text-align` il valore `center`. + +# --hints-- + +Dovresti avere un selettore `h1` nell'elemento `style`. + +```js +const hasSelector = new __helpers.CSSHelp(document).getStyle('h1'); +assert(hasSelector); +``` + +La proprietà `text-align` dovrebbe avere il valore `center`. + +```js +const hasTextAlign = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['text-align'] === 'center'); +assert(hasTextAlign); +``` + +Il selettore `h1` dovrebbe assegnare alla proprietà `text-align` il valore `center`. + +```js +const h1TextAlign = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('text-align'); +assert(h1TextAlign === 'center'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Cafe Menu +--fcc-editable-region-- + +--fcc-editable-region-- + + +
+

CAMPER CAFE

+

Est. 2020

+
+
+
+

Coffee

+
+
+ + +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed6199b0cdef1d2be8f.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed6199b0cdef1d2be8f.md new file mode 100644 index 00000000000..ff3ca6bf622 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed6199b0cdef1d2be8f.md @@ -0,0 +1,85 @@ +--- +id: 5f356ed6199b0cdef1d2be8f +title: Step 27 +challengeType: 0 +dashedName: step-27 +--- + +# --description-- + +Finora hai usato dei selettori di tipo per gli elementi di stile. Un selettore di classe è definito da un nome con un punto direttamente davanti a esso, in questo modo: + +```css +.class-name { + styles +} +``` + +Cambia il selettore `div` esistente in un selettore di classe sostituendo `div` con una classe chiamata `menu`. + +# --hints-- + +Dovresti avere un selettore di classe `.menu`. + +```js +const hasMenu = new __helpers.CSSHelp(document).getStyle('.menu'); +assert(hasMenu); +``` + +Non dovresti avere un selettore `div`. + +```js +const hasDiv = new __helpers.CSSHelp(document).getStyle('div'); +assert(!hasDiv); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + +
+
+

CAMPER CAFE

+

Est. 2020

+
+
+
+

Coffee

+
+
+
+ + +``` + +```css +body { + /* + background-color: burlywood; + */ +} + +h1, h2, p { + text-align: center; +} + +--fcc-editable-region-- +div { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; +} +--fcc-editable-region-- +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3c866d28d7ad0de6470505.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3c866d28d7ad0de6470505.md new file mode 100644 index 00000000000..290361bd6a1 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3c866d28d7ad0de6470505.md @@ -0,0 +1,100 @@ +--- +id: 5f3c866d28d7ad0de6470505 +title: Step 33 +challengeType: 0 +dashedName: step-33 +--- + +# --description-- + +I gusti e i prezzi sono gli uni sopra gli altri e centrati con i loro rispettivi elementi `p`. Sarebbe carino se il gusto fosse a sinistra e il prezzo a destra. + +Aggiungi il nome della classe `flavor` all'elemento `p` di `French Vanilla`. + +# --hints-- + +Dovresti aggiungere la classe `flavor` all'elemento `p`. + +```js +assert(code.match(//i)); +``` + +Dovresti avere un solo elemento con la classe `flavor`. + +```js +assert($('.flavor').length === 1); +``` + +La classe `flavor` dovrebbe essere nell'elemento `p` con il testo `French Vanilla`. + +```js +assert($('.flavor')[0].innerText.match(/French Vanilla/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e01f288a026d709587.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e01f288a026d709587.md new file mode 100644 index 00000000000..31f13b24bdb --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e01f288a026d709587.md @@ -0,0 +1,158 @@ +--- +id: 5f3ef6e01f288a026d709587 +title: Step 67 +challengeType: 0 +dashedName: step-67 +--- + +# --description-- + +È possibile utilizzare un elemento `hr` per visualizzare un separatore tra sezioni con diverso contenuto. + +Per prima cosa, aggiungi un elemento `hr` tra il primo elemento`header`e l'elemento `main`. Nota che gli elementi `hr` sono autoconcludenti. + +# --hints-- + +Dovresti aggiungere un elemento `hr`. Gli elementi `hr` sono autoconcludenti. + +```js +assert(code.match(//i)); +assert(!code.match(/<\/hr>/i)); +``` + +Non dovresti cambiare l'elemento `header` esistente. + +```js +assert($('header').length === 1); +``` + +Non dovresti cambiare l'elemento `main` esistente. + +```js +assert($('main').length === 1); +``` + +L'elemento `hr` dovrebbe essere tra l'elemento `header` e l'elemento `main`. + +```js +assert($('hr')[0].previousElementSibling.tagName === 'HEADER'); +assert($('hr')[0].nextElementSibling.tagName === 'MAIN'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e03d719d5ac4738993.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e03d719d5ac4738993.md new file mode 100644 index 00000000000..5367b470159 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e03d719d5ac4738993.md @@ -0,0 +1,122 @@ +--- +id: 5f3ef6e03d719d5ac4738993 +title: Step 57 +challengeType: 0 +dashedName: step-57 +--- + +# --description-- + +La larghezza corrente del menu occuperà sempre l'80% della larghezza dell'elemento `body`. Su uno schermo molto ampio, i caffè e i dessert appaiono molto lontani dai loro prezzi. + +Aggiungi una proprietà `max-width` alla classe `menu` con un valore di `500px` per evitare che la sua larghezza diventi eccessiva. + +# --hints-- + +Dovresti assegnare alla proprietà `max-width` il valore `500px`. + +```js +const hasMaxWidth = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['max-width'] === '500px'); +assert(hasMaxWidth); +``` + +L'elemento `.menu` dovrebbe avere una proprietà `max-width` con il valore `500px`. + +```js +const menuMaxWidth = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('max-width'); +assert(menuMaxWidth === '500px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +--fcc-editable-region-- +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e04559b939080db057.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e04559b939080db057.md new file mode 100644 index 00000000000..aa0e75bc223 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e04559b939080db057.md @@ -0,0 +1,147 @@ +--- +id: 5f3ef6e04559b939080db057 +title: Step 56 +challengeType: 0 +dashedName: step-56 +--- + +# --description-- + +Visto che tutti e 4 i lati del menu hanno la stessa spaziatura interna, prosegui ed elimina le quattro proprietà utilizzando una singola proprietà `padding` con il valore `20px`. + +# --hints-- + +Dovresti rimuovere la proprietà `padding-left`. + +```js +assert(!code.match(/padding-left/i)); +``` + +Dovresti rimuovere la proprietà `padding-right`. + +```js +assert(!code.match(/padding-right/i)); +``` + +Dovresti rimuovere la proprietà `padding-top`. + +```js +assert(!code.match(/padding-top/i)); +``` + +Dovresti rimuovere la proprietà `padding-bottom`. + +```js +assert(!code.match(/padding-bottom/i)); +``` + +Dovresti assegnare alla proprietà `padding` il valore `20px`. + +```js +const hasPadding = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['padding'] === '20px'); +assert(hasPadding); +``` + +L'elemento `.menu` dovrebbe avere una proprietà `padding` con il valore `20px`. + +```js +const menuPadding = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding'); +assert(menuPadding === '20px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +--fcc-editable-region-- +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding-left: 20px; + padding-right: 20px; + padding-top: 20px; + padding-bottom: 20px; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e050279c7a4a7101d3.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e050279c7a4a7101d3.md new file mode 100644 index 00000000000..49d3f7b8e07 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e050279c7a4a7101d3.md @@ -0,0 +1,144 @@ +--- +id: 5f3ef6e050279c7a4a7101d3 +title: Step 55 +challengeType: 0 +dashedName: step-55 +--- + +# --description-- + +Adesso va meglio. Ora prova ad aggiungere lo stesso padding di `20px` nella parte superiore (top) e inferiore (bottom) del menu. + +# --hints-- + +Non dovresti rimuovere le proprietà `padding-left` o `padding-right`. + +```js +const paddingLeft = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-left'); +assert(paddingLeft === '20px'); +const paddingRight = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-right'); +assert(paddingRight === '20px'); +``` + +Dovresti assegnare alla proprietà `padding-top` il valore `20px`. + +```js +const hasPaddingTop = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['padding-top'] === '20px'); +assert(hasPaddingTop); +``` + +Dovresti assegnare alla proprietà `padding-bottom` il valore `20px`. + +```js +const hasPaddingBottom = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['padding-top'] === '20px'); +assert(hasPaddingBottom); +``` + +L'elemento `.menu` dovrebbe avere una proprietà `padding-top` con il valore `20px`. + +```js +const menuPaddingTop = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-top'); +assert(menuPaddingTop === '20px'); +``` + +L'elemento `.menu` dovrebbe avere un `padding-bottom` con il valore `20px`. + +```js +const menuPaddingBottom = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-bottom'); +assert(menuPaddingBottom === '20px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +--fcc-editable-region-- +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding-left: 20px; + padding-right: 20px; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e05473f91f948724ab.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e05473f91f948724ab.md new file mode 100644 index 00000000000..5dbb79e0247 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e05473f91f948724ab.md @@ -0,0 +1,121 @@ +--- +id: 5f3ef6e05473f91f948724ab +title: Step 58 +challengeType: 0 +dashedName: step-58 +--- + +# --description-- + +Puoi cambiare la proprietà `font-family`, per rendere il testo diverso dal carattere predefinito del browser. In ogni browser sono disponibili alcuni caratteri comuni. + +Cambia tutto il testo nell'elemento `body` aggiungendo una proprietà `font-family` con il valore `sans-serif`. Questo è un carattere abbastanza comune ed è molto leggibile. + +# --hints-- + +Dovresti assegnare alla proprietà `font-family` il valore `sans-serif`. + +```js +const hasFontFamily = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['font-family'] === 'sans-serif'); +``` + +L'elemento `body` dovrebbe avere un `font-family` con il valore `sans-serif`. + +```js +const bodyFontFamily = new __helpers.CSSHelp(document).getStyle('body')?.getPropertyValue('font-family'); +assert(bodyFontFamily === 'sans-serif'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +--fcc-editable-region-- +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} +--fcc-editable-region-- + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e056bdde6ae6892ba2.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e056bdde6ae6892ba2.md new file mode 100644 index 00000000000..612986b9408 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e056bdde6ae6892ba2.md @@ -0,0 +1,138 @@ +--- +id: 5f3ef6e056bdde6ae6892ba2 +title: Step 59 +challengeType: 0 +dashedName: step-59 +--- + +# --description-- + +È un po' noioso che tutto il testo abbia la stessa proprietà `font-family`. Puoi ancora avere la maggior parte del testo `sans-serif` e differenziare solo gli elementi `h1` e `h2` utilizzando un altro selettore. + +Cambia il carattere degli elementi `h1` e `h2` in modo che solo il testo di questi elementi utilizzi il carattere `Impact`. + +# --hints-- + +Dovresti usare un selettore `h1, h2`. + +```js +const h1h2Selector = new __helpers.CSSHelp(document).getStyle('h1, h2'); +assert(h1h2Selector); +``` + +Dovresti assegnare alla proprietà `font-family` il valore `Impact`. + +```js +const hasFontFamily = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['font-family'] === 'Impact'); +assert(hasFontFamily); +``` + +L'elemento `h1` dovrebbe avere una proprietà `font-family` con il valore `Impact`. + +```js +assert($('h1').css('font-family').match(/impact/i)); +``` + +L'elemento `h2` dovrebbe avere una proprietà `font-family` con il valore `Impact`. + +```js +assert($('h2').css('font-family').match(/impact/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e06d34faac0447fc44.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e06d34faac0447fc44.md new file mode 100644 index 00000000000..f1050c694a3 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e06d34faac0447fc44.md @@ -0,0 +1,135 @@ +--- +id: 5f3ef6e06d34faac0447fc44 +title: Step 61 +challengeType: 0 +dashedName: step-61 +--- + +# --description-- + +Crea un selettore di classe `established` e assegna alla proprietà `font-style` il valore `italic` per far sì che il testo `Est. 2020` sia in corsivo. + +# --hints-- + +Dovresti avere un selettore `.established`. + +```js +const hasEstablished = new __helpers.CSSHelp(document).getStyle('.established'); +assert(hasEstablished); +``` + +Dovresti assegnare alla proprietà `font-style` il valore `italic`. + +```js +const hasFontStyle = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['font-style'] === 'italic'); +assert(hasFontStyle); +``` + +Il selettore `.established` dovrebbe assegnare alla proprietà `font-style` il valore `italic`. + +```js +const establishedFontStyle = new __helpers.CSSHelp(document).getStyle('.established')?.getPropertyValue('font-style'); +assert(establishedFontStyle === 'italic'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e07276f782bb46b93d.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e07276f782bb46b93d.md new file mode 100644 index 00000000000..88b84038fdc --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e07276f782bb46b93d.md @@ -0,0 +1,149 @@ +--- +id: 5f3ef6e07276f782bb46b93d +title: Step 64 +challengeType: 0 +dashedName: step-64 +--- + +# --description-- + +Al di sotto dell'elemento `main`, aggiungi un elemento `footer` in cui inserire alcune informazioni aggiuntive. + +# --hints-- + +Dovresti avere un tag di apertura `
`. + +```js +assert(code.match(/
/i)); +``` + +Dovresti avere un tag di chiusura `
`. + +```js +assert(code.match(/<\/footer>/i)); +``` + +Non dovresti modificare l'elemento `main` esistente. + +```js +assert($('main').length === 1); +``` + +L'elemento `footer` dovrebbe essere al di sotto dell'elemento `main`. + +```js +const footer = $('footer')[0] +assert(footer.previousElementSibling.tagName === 'MAIN'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e087d56ed3ffdc36be.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e087d56ed3ffdc36be.md new file mode 100644 index 00000000000..8d25d786da4 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e087d56ed3ffdc36be.md @@ -0,0 +1,134 @@ +--- +id: 5f3ef6e087d56ed3ffdc36be +title: Step 62 +challengeType: 0 +dashedName: step-62 +--- + +# --description-- + +Ora applica la classe `established` al testo `Est. 2020`. + +# --hints-- + +Dovresti assegnare alla classe dell'elemento `p` il valore `established`. + +```js +assert(code.match(/

/i)); +``` + +La classe `established` dovrebbe essere sull'elemento con il testo `Est. 2020`. + +```js +const established = $('.established'); +assert(established[0].innerText.match(/Est\.\s2020/i)); +``` + +Il testo dell'elemento di classe `established` dovrebbe essere in corsivo. + +```js +assert($('.established').css('font-style') === 'italic'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + +

+ + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0a81099d9a697b550.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0a81099d9a697b550.md new file mode 100644 index 00000000000..fb7a5f72eca --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0a81099d9a697b550.md @@ -0,0 +1,156 @@ +--- +id: 5f3ef6e0a81099d9a697b550 +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +Aggiungi un elemento `p` all'interno del `footer`. Poi, annida un elemento di ancoraggio (`a`) nell'elemento `p` contenente il link `https://www.freecodecamp.org` e il testo `Visit our website`. + +# --hints-- + +Non dovresti modificare l'elemento `footer` esistente. + +```js +assert($('footer').length === 1); +``` + +Il nuovo elemento `p` dovrebbe essere annidato nell'elemento `footer`. + +```js +assert($('footer').children('p').length === 1); +``` + +Il nuovo elemento `a` dovrebbe essere annidato nell'elemento `p`. + +```js +assert($('footer').children('p').children('a').length === 1); +``` + +Il nuovo elemento `a` dovrebbe avere il testo `Visit our website`. + +```js +assert($('footer').find('a')[0].innerText.match(/Visit our website/i)); +``` + +Il nuovo elemento `a` dovrebbe contenere il link `https://www.freecodecamp.org`. Ricorda che gli elementi `a` utilizzano l'attributo `href` per creare un link. + +```js +assert($('footer').find('a').attr('href') === 'https://www.freecodecamp.org'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0b431cc215bb16f55.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0b431cc215bb16f55.md new file mode 100644 index 00000000000..79d0aca6ae3 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0b431cc215bb16f55.md @@ -0,0 +1,141 @@ +--- +id: 5f3ef6e0b431cc215bb16f55 +title: Step 66 +challengeType: 0 +dashedName: step-66 +--- + +# --description-- + +Aggiungi un secondo elemento `p` sotto quello con il link e assegnagli il testo `123 Free Code Camp Drive`. + +# --hints-- + +Dovresti aggiungere un secondo elemento `p` al tuo elemento `footer`. + +```js +assert($('footer').children('p').length === 2); +``` + +Il nuovo elemento `p` dovrebbe avere il testo `123 Free Code Camp Drive`. Assicurati di aggiungere il nuovo elemento dopo quello esistente. + +```js +assert($('footer').children('p').last().text().match(/123 Free Code Camp Drive/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e9629bad967cd71e.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e9629bad967cd71e.md new file mode 100644 index 00000000000..d688b527f58 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e9629bad967cd71e.md @@ -0,0 +1,121 @@ +--- +id: 5f3ef6e0e9629bad967cd71e +title: Step 60 +challengeType: 0 +dashedName: step-60 +--- + +# --description-- + +Puoi aggiungere un valore fallback per la proprietà font-family aggiungendo un altro font separato da una virgola. I fallback sono utilizzati nel caso in cui il primo font non è disponibile o non viene trovato. + +Aggiungi il fontdi fallback `serif` dopo il font `Impact`. + +# --hints-- + +Dovresti aggiungere `serif` come fallback per il font `Impact`. + +```js +const fontFamily = new __helpers.CSSHelp(document).getStyle('h1, h2')?.getPropertyValue('font-family'); +assert(fontFamily === 'Impact, serif'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +--fcc-editable-region-- +h1, h2 { + font-family: Impact; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0eaa7da26e3d34d78.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0eaa7da26e3d34d78.md new file mode 100644 index 00000000000..24ba1003a84 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0eaa7da26e3d34d78.md @@ -0,0 +1,135 @@ +--- +id: 5f3ef6e0eaa7da26e3d34d78 +title: Step 54 +challengeType: 0 +dashedName: step-54 +--- + +# --description-- + +Puoi dare al menu uno spazio tra il contenuto e i lati usando varie proprietà `padding`. + +Assegna lo stesso valore di `20px` alle proprietà `padding-left` e `padding-right` della classe `menu`. + +# --hints-- + +Dovresti assegnare alla proprietà `padding-left` il valore `20px`. + +```js +const hasPaddingLeft = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['padding-left'] === '20px'); +assert(hasPaddingLeft); +``` + +Dovresti assegnare alla proprietà `padding-right` il valore `20px`. + +```js +const hasPaddingRight = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['padding-right'] === '20px'); +assert(hasPaddingRight); +``` + +L'elemento `.menu` dovrebbe avere un `padding-left` con il valore `20px`. + +```js +const menuPaddingLeft = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-left'); +assert(menuPaddingLeft === '20px'); +``` + +L'elemento `.menu` dovrebbe avere un `padding-right` con il valore `20px`. + +```js +const menuPaddingRight = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-right'); +assert(menuPaddingRight === '20px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +--fcc-editable-region-- +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0f8c230bdd2349716.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0f8c230bdd2349716.md new file mode 100644 index 00000000000..8ff56d5faae --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0f8c230bdd2349716.md @@ -0,0 +1,147 @@ +--- +id: 5f3ef6e0f8c230bdd2349716 +title: Step 63 +challengeType: 0 +dashedName: step-63 +--- + +# --description-- + +La tipografia degli elementi di intestazione (ad esempio `h1`, `h2`) è impostata sui valori predefiniti dei browser degli utenti. + +Aggiungi due nuovi selettori di tipo (`h1` e `h2`). Usa la proprietà `font-size` per entrambi, ma utilizza il valore `40px` per `h1` e `30px` per `h2`. + +# --hints-- + +Dovresti usare un selettore `h1`. + +```js +const hasH1 = new __helpers.CSSHelp(document).getStyle('h1'); +assert(hasH1); +``` + +Dovresti usare un selettore `h2`. + +```js +const hasH2 = new __helpers.CSSHelp(document).getStyle('h2'); +assert(hasH2); +``` + +L'elemento `h1` dovrebbe avere una proprietà `font-size` di `40px`. + +```js +const h1FontSize = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('font-size'); +assert(h1FontSize === '40px'); +``` + +L'elemento `h2` dovrebbe avere una proprietà `font-size` di `30px`. + +```js +const h2FontSize = new __helpers.CSSHelp(document).getStyle('h2')?.getPropertyValue('font-size'); +assert(h2FontSize === '30px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3f26fa39591db45e5cd7a0.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3f26fa39591db45e5cd7a0.md new file mode 100644 index 00000000000..a9b4e690e19 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3f26fa39591db45e5cd7a0.md @@ -0,0 +1,156 @@ +--- +id: 5f3f26fa39591db45e5cd7a0 +title: Step 68 +challengeType: 0 +dashedName: step-68 +--- + +# --description-- + +Le proprietà predefinite di un elemento `hr` lo faranno apparire come una sottile linea di colore grigio chiaro. Puoi modificare l'altezza della linea specificando un valore per la proprietà `height`. + +Cambia l'altezza dell'elemento `hr` in `3px`. + +# --hints-- + +Dovresti usare il selettore `hr`. + +```js +const hasHr = new __helpers.CSSHelp(document).getStyle('hr'); +assert(hasHr); +``` + +Dovresti assegnare alla proprietà `height` il valore `3px`. + +```js +const hasHeight = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style.height === '3px'); +assert(hasHeight); +``` + +L'elemento `hr` dovrebbe avere una proprietà `height` con il valore `3 px`. + +```js +const hrHeight = new __helpers.CSSHelp(document).getStyle('hr')?.getPropertyValue('height'); +assert(hrHeight === '3px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459225127805351a6ad057.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459225127805351a6ad057.md index 82dc086dedb..4b8daacf90e 100644 --- a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459225127805351a6ad057.md +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459225127805351a6ad057.md @@ -11,13 +11,13 @@ Cambia il colore di sfondo dell'elemento `hr` in `brown` in modo che corrisponda # --hints-- -Dovresti impostare il valore della proprietà `background-color` su `brown`. +Dovresti assegnare alla proprietà `background-color` il valore `brown`. ```js const hasBackgroundColor = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['background-color'] === 'brown'); ``` -Il tuo elemento `hr` dovrebbe avere un `background-color` di `brown`. +L'elemento `hr` dovrebbe avere una proprietà `background-color` con il valore `brown`. ```js const hrBackgroundColor = new __helpers.CSSHelp(document).getStyle('hr')?.getPropertyValue('background-color'); diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459a7ceb8b5c446656d88b.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459a7ceb8b5c446656d88b.md new file mode 100644 index 00000000000..3b3bba5a989 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459a7ceb8b5c446656d88b.md @@ -0,0 +1,152 @@ +--- +id: 5f459a7ceb8b5c446656d88b +title: Step 70 +challengeType: 0 +dashedName: step-70 +--- + +# --description-- + +Nota il colore grigio lungo i bordi della linea. Questi bordi sono conosciuti come border. Ogni lato di un elemento può avere un colore diverso o possono essere tutti uguali. + +Rendi tutti i bordi dell'elemento `hr` dello stesso colore dello sfondo usando la proprietà `border-color`. + +# --hints-- + +Dovresti assegnare alla proprietà `border-color` il valore `brown`. + +```js +const hasBorderColor = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['border-color'] === 'brown'); +assert(hasBorderColor); +``` + +Il valore della proprietà `border-color` dell'elemento `hr` dovrebbe essere `brown`. + +```js +const hrBorderColor = new __helpers.CSSHelp(document).getStyle('hr')?.getPropertyValue('border-color'); +assert(hrBorderColor === 'brown'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +--fcc-editable-region-- +hr { + height: 3px; + background-color: brown; +} +--fcc-editable-region-- + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459fd48bdc98491ca6d1a3.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459fd48bdc98491ca6d1a3.md new file mode 100644 index 00000000000..ca763123ba7 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f459fd48bdc98491ca6d1a3.md @@ -0,0 +1,150 @@ +--- +id: 5f459fd48bdc98491ca6d1a3 +title: Step 72 +challengeType: 0 +dashedName: step-72 +--- + +# --description-- + +Vai avanti e aggiungi un altro elemento `hr` tra l'elemento `main` e l'elemento `footer`. + +# --hints-- + +Dovresti aggiungere un secondo elemento `hr`. + +```js +assert($('hr').length === 2); +``` + +Il nuovoelemento `hr` dovrebbe essere tra l'elemento `main` e l'elemento `footer`. + +```js +assert($('hr')[1].previousElementSibling.tagName === 'MAIN'); +assert($('hr')[1].nextElementSibling.tagName === 'FOOTER'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a05977e2fa49d9119437.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a05977e2fa49d9119437.md new file mode 100644 index 00000000000..b4ce2fccc84 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a05977e2fa49d9119437.md @@ -0,0 +1,150 @@ +--- +id: 5f45a05977e2fa49d9119437 +title: Step 73 +challengeType: 0 +dashedName: step-73 +--- + +# --description-- + +Per creare più spazio intorno al menu, aggiungi `20px` all'interno dell'elemento `body` utilizzando la proprietà `padding`. + +# --hints-- + +Dovresti assegnare alla proprietà `padding` il valore `20px`. + +```js +assert(code.match(/padding:\s*20px;?/i)); +``` + +L'elemento `body` dovrebbe avere una proprietà `padding` con il valore `20px`. + +```js +const bodyPadding = new __helpers.CSSHelp(document).getStyle('body')?.getPropertyValue('padding'); +assert(bodyPadding === '20px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +--fcc-editable-region-- +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} +--fcc-editable-region-- + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a276c093334f0f6e9df4.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a276c093334f0f6e9df4.md new file mode 100644 index 00000000000..1983cf1189b --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a276c093334f0f6e9df4.md @@ -0,0 +1,176 @@ +--- +id: 5f45a276c093334f0f6e9df4 +title: Step 74 +challengeType: 0 +dashedName: step-74 +--- + +# --description-- + +Se consideriamo le voci sul menu e i prezzi, c'è un divario abbastanza grande tra ogni linea. + +Assegna alle proprietà margin-top e margin-bottom il valore `5px` per tutti gli elementi `p` annidati in elementi di classe `item`. + +# --hints-- + +Dovresti assegnare alla proprietà `margin-top` il valore `5px`. + +```js +const hasMarginTop = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-top'] === '5px'); +assert(hasMarginTop); +``` + +Dovresti assegnare alla proprietà `margin-bottom` il valore `5px`. + +```js +const hasMarginBottom = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-bottom'] === '5px'); +assert(hasMarginBottom); +``` + +Dovresti utilizzare il selettore `.item p` esistente. + +```js +const hasOneSelector = new __helpers.CSSHelp(document).getStyleDeclarations('.item p'); +assert(hasOneSelector.length === 1); +``` + +Gli elementi `p` annidati negli elementi `.item` dovrebbero avere una proprietà `margin-top` con il valore `5px`. + +```js +const itemPMarginTop = new __helpers.CSSHelp(document).getStyle('.item p')?.getPropertyValue('margin-top'); +assert(itemPMarginTop === '5px'); +``` + +Gli elementi `p` annidati negli elementi `.item` dovrebbero avere una proprietà `margin-bottom` con il valore `5px`. + +```js +const itemPMarginBottom = new __helpers.CSSHelp(document).getStyle('.item p')?.getPropertyValue('margin-bottom'); +assert(itemPMarginBottom === '5px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +--fcc-editable-region-- +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +--fcc-editable-region-- +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a5a7c49a8251f0bdb527.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a5a7c49a8251f0bdb527.md new file mode 100644 index 00000000000..8ae77aa2b7e --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a5a7c49a8251f0bdb527.md @@ -0,0 +1,162 @@ +--- +id: 5f45a5a7c49a8251f0bdb527 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +Usando lo stesso selettore di stile del passaggio precedente, aumenta la dimensione del font delle voci del menu e dei prezzi più fino a `18px`. + +# --hints-- + +Dovresti assegnare alla proprietà `font-size` il valore `18px`. + +```js +const hasFontSize = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['font-size'] === '18px'); +assert(hasFontSize); +``` + +Dovresti utilizzare il selettore `.item p` esistente. + +```js +const hasOneSelector = new __helpers.CSSHelp(document).getStyleDeclarations('.item p'); +assert(hasOneSelector.length === 1); +``` + +Gli elementi `p` annidati negli elementi `.item` dovrebbero avere una proprietà `font-size` con il valore `18px`. + +```js +const itemPFontSize = new __helpers.CSSHelp(document).getStyle('.item p')?.getPropertyValue('font-size'); +assert(itemPFontSize === '18px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +h1, h2 { + font-family: Impact, serif; +} + +--fcc-editable-region-- +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; +} +--fcc-editable-region-- + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a66d4a2b0453301e5a26.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a66d4a2b0453301e5a26.md new file mode 100644 index 00000000000..adc94964881 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45a66d4a2b0453301e5a26.md @@ -0,0 +1,178 @@ +--- +id: 5f45a66d4a2b0453301e5a26 +title: Step 79 +challengeType: 0 +dashedName: step-79 +--- + +# --description-- + +Fai sì che la dimensione di tutto il testo dell'elemento `footer` sia di `14px`. + +# --hints-- + +Dovresti avere un selettore `footer`. + +```js +const hasFooter = new __helpers.CSSHelp(document).getStyle('footer'); +assert(hasFooter); +``` + +Il selettore `footer` dovrebbe trovarsi al di sotto del commento. + +```js +assert(code.match(/\/\*\s*FOOTER\s*\*\/\s*footer/i)); +``` + +Dovresti assegnare alla proprietà `font-size` il valore `14px`. + + +```js +const hasFontSize = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['font-size'] === '14px'); +assert(hasFontSize); +``` + +L'elemento `footer` dovrebbe avere una proprietà `font-size` con il valore `14px`. + +```js +const footerFontSize = new __helpers.CSSHelp(document).getStyle('footer')?.getPropertyValue('font-size'); +assert(footerFontSize === '14px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b0731d39e15d54df4dfc.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b0731d39e15d54df4dfc.md new file mode 100644 index 00000000000..7d18972825c --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b0731d39e15d54df4dfc.md @@ -0,0 +1,175 @@ +--- +id: 5f45b0731d39e15d54df4dfc +title: Step 80 +challengeType: 0 +dashedName: step-80 +--- + +# --description-- + +Il colore predefinito di un link che non è stato ancora cliccato è blu. Invece, il colore predefinito di un link che è già stato visitato da una pagina è viola. + +Per rendere il link nel `footer` dello stesso colore indipendentemente dal fatto che sia stato visitato, usa un selettore di tipo per l'elemento di ancoraggio (`a`) assegnando il valore `black` alla proprietà `color`. + +# --hints-- + +Dovresti usare un selettore `a`. + +```js +const hasASelector = new __helpers.CSSHelp(document).getStyle('a'); +assert(hasASelector); +``` + +Dovresti assegnare alla proprietà `color` il valore `black`. + +```js +const hasColor = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style.color === 'black'); +``` + +L'elemento `a` dovrebbe avere una proprietà `color` con il valore `black`. + +```js +const aColor = new __helpers.CSSHelp(document).getStyle('a')?.getPropertyValue('color'); +assert(aColor === 'black'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b25e7ec2405f166b9de1.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b25e7ec2405f166b9de1.md new file mode 100644 index 00000000000..c14270e9c64 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b25e7ec2405f166b9de1.md @@ -0,0 +1,182 @@ +--- +id: 5f45b25e7ec2405f166b9de1 +title: Step 81 +challengeType: 0 +dashedName: step-81 +--- + +# --description-- + +Puoi cambiare le proprietà di un link che è già stato visitato usando il seguente pseudo-selettore: `a:visited { nomeProprietà: valoreProprietà; }`. + +Cambia il colore del link nel piè di pagina `Visit our website` in `grey` quando un utente ha visitato il link. + +# --hints-- + +Dovresti utilizzare lo pseudoselettore `a:visited`. + +```js +const hasAVisited = new __helpers.CSSHelp(document).getStyle('a:visited'); +assert(hasAVisited); +``` + +Dovresti assegnare alla proprietà `color` il valore `grey`. + +```js +const hasColor = new __helpers.CSSHelp(document).getCSSRules().some(x => (x.style.color === 'grey' || x.style.color === 'gray')); +assert(hasColor); +``` + +`a:visited` dovrebbe avere una proprietà `color` con il valore `grey`. + +```js +const aVisitedColor = new __helpers.CSSHelp(document).getStyle('a:visited')?.getPropertyValue('color'); +assert(aVisitedColor === 'grey' || aVisitedColor === 'gray'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +a { + color: black; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b3c93c027860d9298dbd.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b3c93c027860d9298dbd.md new file mode 100644 index 00000000000..680245faa09 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b3c93c027860d9298dbd.md @@ -0,0 +1,186 @@ +--- +id: 5f45b3c93c027860d9298dbd +title: Step 82 +challengeType: 0 +dashedName: step-82 +--- + +# --description-- + +Puoi cambiare le proprietà di un link quando il puntatore del mouse gli passa sopra usando il seguente pseudo-selettore: `a:hover { nomeProprietà: valoreProprietà; }`. + +Cambia il colore del link nel piè di pagina `Visit our website` in `brown` quando un utente gli passa sopra con il mouse. + +# --hints-- + +Dovresti usare lo pseudoselettore `a:hover`. + +```js +const hasAHover = new __helpers.CSSHelp(document).getStyle('a:hover'); +assert(hasAHover); +``` + +Dovresti assegnare alla proprietà `color` il valore `brown`. + +```js +const hasColor = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style.color === 'brown'); +assert(hasColor); +``` + +`a:hover` dovrebbe avere una proprietà `color` con il valore `brown`. + +```js +const aHoverColor = new __helpers.CSSHelp(document).getStyle('a:hover')?.getPropertyValue('color'); +assert(aHoverColor === 'brown'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +a { + color: black; +} + +a:visited { + color: grey; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b45d099f3e621fbbb256.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b45d099f3e621fbbb256.md new file mode 100644 index 00000000000..09417e05cbf --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b45d099f3e621fbbb256.md @@ -0,0 +1,189 @@ +--- +id: 5f45b45d099f3e621fbbb256 +title: Step 83 +challengeType: 0 +dashedName: step-83 +--- + +# --description-- + +Puoi cambiare le proprietà di un link che sta venendo cliccato usando il seguente pseudo-selettore: `a:active { nomeProprietà: valoreProprietà; }`. + +Cambia il colore del link nel piè di pagina `Visit our website` in `white` quando viene cliccato. + +# --hints-- + +Dovresti usare lo pseudo-selettore `a:active`. + +```js +const hasAActive = new __helpers.CSSHelp(document).getStyle('a:active'); +assert(hasAActive); +``` + +Dovresti assegnarre alla proprietà `color` il valore `white`. + +```js +const hasColor = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style.color === 'white'); +assert(hasColor); +``` + +`a:active` dovrebbe avere una proprietà `color` con il valore `white`. + +```js +const aActiveColor = new __helpers.CSSHelp(document).getStyle('a:active')?.getPropertyValue('color'); +assert(aActiveColor === 'white'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +a { + color: black; +} + +a:visited { + color: grey; +} + +a:hover { + color: brown; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b4c81cea7763550e40df.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b4c81cea7763550e40df.md new file mode 100644 index 00000000000..08f6c94edde --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b4c81cea7763550e40df.md @@ -0,0 +1,182 @@ +--- +id: 5f45b4c81cea7763550e40df +title: Step 84 +challengeType: 0 +dashedName: step-84 +--- + +# --description-- + +Per mantenere lo stesso colore del tema che hai usato finora (nero e marrone), cambia il colore del link in `black` quando è stato visitato e in `brown` quando viene effettivamente cliccato. + +# --hints-- + +Dovresti assegnare alla proprietà `color` il valore `black` quando il link è `visited`. + +```js +const aVisitedColor = new __helpers.CSSHelp(document).getStyle('a:visited')?.getPropertyValue('color'); +assert(aVisitedColor === 'black'); +``` + +Dovresti assegnare alla proprietà `color` il valore `brown` seil link è `active`. + +```js +const aActiveColor = new __helpers.CSSHelp(document).getStyle('a:active')?.getPropertyValue('color'); +assert(aActiveColor === 'brown'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +a { + color: black; +} + +--fcc-editable-region-- +a:visited { + color: grey; +} + +a:hover { + color: brown; +} + +a:active { + color: white; +} +--fcc-editable-region-- +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b715301bbf667badc04a.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b715301bbf667badc04a.md new file mode 100644 index 00000000000..922b61137a1 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f45b715301bbf667badc04a.md @@ -0,0 +1,184 @@ +--- +id: 5f45b715301bbf667badc04a +title: Step 85 +challengeType: 0 +dashedName: step-85 +--- + +# --description-- + +Il testo del menu `CAMPER CAFE` ha uno spazio diverso dall'alto rispetto all'indirizzo in fondo al menu. Ciò è dovuto al browser che ha un margine superiore predefinito per l'elemento `h1`. + +Cambia il margine superiore dell'elemento `h1` in `0` per rimuovere tutto il margine superiore. + +# --hints-- + +Dovresti assegnare alla proprietà `margin-top` il valore `0`. + +```js +const hasMarginTop = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-top'] === '0px'); +assert(hasMarginTop); +``` + +L'elemento `h1` dovrebbe avere una proprietà `margin-top` con il valore `0`. + +```js +const h1MarginTop = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('margin-top'); +assert(h1MarginTop === '0px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +--fcc-editable-region-- +h1 { + font-size: 40px; +} +--fcc-editable-region-- + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e270702a8456a664f0df.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e270702a8456a664f0df.md index c214fac2b9b..0eb4c5761c0 100644 --- a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e270702a8456a664f0df.md +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e270702a8456a664f0df.md @@ -7,18 +7,18 @@ dashedName: step-86 # --description-- -Per rimuovere parte dello spazio verticale tra l'elemento `h1` e il testo `Est. 2020`, modifica il margine inferiore dell'elemento `h1` impostandolo a `15px`. +Per rimuovere parte dello spazio verticale tra l'elemento `h1` e il testo `Est. 2020`, modifica il margine inferiore dell'elemento `h1` in `15px`. # --hints-- -Dovresti impostare la proprietà `margin-bottom` su `15px`. +Dovresti assegnare alla proprietà `margin-bottom` il valore `15px`. ```js const hasMarginBottom = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-bottom'] === '15px'); assert(hasMarginBottom); ``` -Il tuo elemento `h1` dovrebbe avere un `margin-bottom` di `15px`. +L'elemento `h1` dovrebbe avere una proprietà `margin-bottom` con il valore `15px`. ```js const h1MarginBottom = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('margin-bottom'); diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e36e745ead58487aabf2.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e36e745ead58487aabf2.md new file mode 100644 index 00000000000..8ffc940bd2e --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e36e745ead58487aabf2.md @@ -0,0 +1,195 @@ +--- +id: 5f46e36e745ead58487aabf2 +title: Step 87 +challengeType: 0 +dashedName: step-87 +--- + +# --description-- + +Adesso la spaziatura superiore sembra buona. Lo spazio al di sotto dell'indirizzo nella parte inferiore del menu è leggermente più grande dello spazio tra la parte superiore del menu e l'elemento `h1`. + +Per diminuire lo spazio predefinito del margine sotto l'elemento `p` con l'indirizzo, crea un selettore di classe chiamato `address` e assegna il valore `5px` alla proprietà `margin-bottom`. + +# --hints-- + +Dovresti aggiungere un selettore `.address`. + +```js +const hasAddress = new __helpers.CSSHelp(document).getStyle('.address'); +assert(hasAddress); +``` + +Dovresti assegnare alla proprietà `margin-bottom` il valore `5px`. + +```js +const hasMarginBottom = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-bottom'] === '5px'); +assert(hasMarginBottom); +``` + +Il selettore `.address` dovrebbe avere la proprietà `margin-bottom` con il valore `5px`. + +```js +const addressMarginBottom = new __helpers.CSSHelp(document).getStyle('.address')?.getPropertyValue('margin-bottom'); +assert(addressMarginBottom === '5px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; + margin-top: 0; + margin-bottom: 15px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e7a4750dd05b5a673920.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e7a4750dd05b5a673920.md new file mode 100644 index 00000000000..604fa198d50 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e7a4750dd05b5a673920.md @@ -0,0 +1,191 @@ +--- +id: 5f46e7a4750dd05b5a673920 +title: Step 88 +challengeType: 0 +dashedName: step-88 +--- + +# --description-- + +Ora applica la classe `address` all'elemento `p` contenente l'indirizzo. + +# --hints-- + +Dovresti applicare l'attributo `class="address"`. + +```js +assert(code.match(/class=('|")address\1/i)); +``` + +L'elemento `.address` dovrebbe essere il tuo elemento `p`. + +```js +assert($('.address')[0].tagName === 'P'); +``` + +L'elemento `.address` dovrebbe avere il testo `123 freeCodeCamp Drive`. + +```js +assert($('.address')[0].innerText.match(/123 Free Code Camp Drive/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; + margin-top: 0; + margin-bottom: 15px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +.address { + margin-bottom: 5px; +} + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e8284aae155c83015dee.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e8284aae155c83015dee.md new file mode 100644 index 00000000000..a31b55f42ef --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46e8284aae155c83015dee.md @@ -0,0 +1,194 @@ +--- +id: 5f46e8284aae155c83015dee +title: Step 89 +challengeType: 0 +dashedName: step-89 +--- + +# --description-- + +Il menu sembra buono, ma a parte l'immagine di sfondo dei chicchi di caffè, il resto è quasi solo testo. + +Sotto l'intestazione `Coffee`, aggiungi un'immagine usando l'url `https://cdn.freecodecamp.org/curriculum/css-cafe/coffee.jpg`. Assegna all'immagine il valore `alt` di `coffee icon`. + +# --hints-- + +Dovresti avere un tag ``. Ricorda che gli elementi `img` sono autoconcludenti. + +```js +assert($('img').length === 1); +``` + +L'elemento `img` dovrebbe avere un attributo `src` con il valore `https://cdn.freecodecamp.org/curriculum/css-cafe/coffee.jpg`. + +```js +assert($('img').attr('src') === 'https://cdn.freecodecamp.org/curriculum/css-cafe/coffee.jpg'); +``` + +L'elemento `img` dovrebbe avere un attributo `alt` con il valore `coffee icon`. + +```js +assert($('img').attr('alt').match(/coffee icon/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; + margin-top: 0; + margin-bottom: 15px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +.address { + margin-bottom: 5px; +} + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46ede1ff8fec5ba656b44c.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46ede1ff8fec5ba656b44c.md new file mode 100644 index 00000000000..0a9cb2baed1 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46ede1ff8fec5ba656b44c.md @@ -0,0 +1,154 @@ +--- +id: 5f46ede1ff8fec5ba656b44c +title: Step 78 +challengeType: 0 +dashedName: step-78 +--- + +# --description-- + +Il prossimo passo è agire sullo stile dell'elemento `footer`. Per mantenere il CSS organizzato, aggiungi un commento alla fine di `styles.css` con il testo `FOOTER`. + +# --hints-- + +Dovresti avere un commento CSS con il testo `FOOTER`. + +```js +assert(code.match(/\/\*\s*FOOTER\s*\*\//i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + +
+ + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46fc57528aa1c4b5ea7c2e.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46fc57528aa1c4b5ea7c2e.md new file mode 100644 index 00000000000..acc3d36c123 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46fc57528aa1c4b5ea7c2e.md @@ -0,0 +1,167 @@ +--- +id: 5f46fc57528aa1c4b5ea7c2e +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Cambiare il valore della proprietà `margin-bottom` in `5px` sembra funzionare. Adesso però, lo spazio tra la voce di menu `Cinnamon Roll` e il secondo elemento `hr` non corrisponde allo spazio tra l'elemento `hr` superiore e l'intestazione `Coffee`. + +Aggiungi più spazio creando una classe chiamata `bottom-line` e usando `25px` per il valore della proprietà `margin-top`. + +# --hints-- + +Dovresti aggiungere un selettore `.bottom-line`. + +```js +const hasBottomLine = new __helpers.CSSHelp(document).getStyle('.bottom-line'); +assert(hasBottomLine); +``` + +Dovresti assegnare alla proprietà `margin-top` il valore `25px`. + +```js +const hasMarginTop = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-top'] === '25px'); +assert(hasMarginTop); +``` + +Il selettore `.bottom-line` dovrebbe avere una proprietà `margin-top` con il valore `25px`. + +```js +const bottomLineMargin = new __helpers.CSSHelp(document).getStyle('.bottom-line')?.getPropertyValue('margin-top'); +assert(bottomLineMargin === '25px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f4701b942c824109626c3d8.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f4701b942c824109626c3d8.md new file mode 100644 index 00000000000..0eaa276541b --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f4701b942c824109626c3d8.md @@ -0,0 +1,157 @@ +--- +id: 5f4701b942c824109626c3d8 +title: Step 77 +challengeType: 0 +dashedName: step-77 +--- + +# --description-- + +Adesso aggiungi la classe `bottom-line` al secondo elemento `hr` in modo da applicare lo stile. + +# --hints-- + +Dovresti applicare la proprietà `class="bottom-line"`. + +```js +assert(code.match(/class=('|")bottom-line\1/i)); +``` + +La classe `bottom-line` dovrebbe essere applicata al secondo elemento `hr`. + +```js +assert($('hr')[1].className === 'bottom-line'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f475bb508746c16c9431d42.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f475bb508746c16c9431d42.md new file mode 100644 index 00000000000..06cc7bf78e7 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f475bb508746c16c9431d42.md @@ -0,0 +1,223 @@ +--- +id: 5f475bb508746c16c9431d42 +title: Step 90 +challengeType: 0 +dashedName: step-90 +--- + +# --description-- + +L'immagine che hai aggiunto non è centrata orizzontalmente come l'intestazione `Coffee` sopra di essa. Gli elementi `img` sono come degli elementi inline. + +Per far sì che l'immagine si comporti come gli elementi di intestazione (che sono a livello di blocco), crea un selettore di tipo `img` e usa il valore `block` per la proprietà `display` e i valori appropriati di `margin-left` e `margin-right` per centrarla orizzontalmente. + +# --hints-- + +Dovresti usare un selettore `img`. + +```js +const hasImg = new __helpers.CSSHelp(document).getStyle('img'); +assert(hasImg); +``` + +Dovresti assegnare alla proprietà `display` il valore `block`. + +```js +const hasDisplay = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style.display === 'block'); +assert(hasDisplay); +``` + +Dovresti assegnare alla proprietà `margin-left` il valore `auto`. + +```js +const marginLeftFilter = new __helpers.CSSHelp(document).getCSSRules().filter(x => x.style['margin-left'] === 'auto'); +assert(marginLeftFilter.length === 2); +``` + +Dovresti assegnare alla proprietà `margin-right` il valore `auto`. + +```js +const marginRightFilter = new __helpers.CSSHelp(document).getCSSRules().filter(x => x.style['margin-right'] === 'auto'); +assert(marginRightFilter.length === 2); +``` + +L'elemento `img` dovrebbe avere una proprietà `display` con il valore `block`. + +```js +const imgDisplay = new __helpers.CSSHelp(document).getStyle('img')?.getPropertyValue('display'); +assert(imgDisplay === 'block'); +``` + +L'elemento `img` dovrebbe avere delle proprietà `margin-left` e `margin-right` con il valore `auto`. + +```js +const imgMarginLeft = new __helpers.CSSHelp(document).getStyle('img')?.getPropertyValue('margin-left'); +assert(imgMarginLeft === 'auto'); +const imgMarginRight = new __helpers.CSSHelp(document).getStyle('img')?.getPropertyValue('margin-right'); +assert(imgMarginRight === 'auto'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; + margin-top: 0; + margin-bottom: 15px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +.address { + margin-bottom: 5px; +} + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f475e1c7f71a61d913836c6.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f475e1c7f71a61d913836c6.md new file mode 100644 index 00000000000..c57df7b2104 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f475e1c7f71a61d913836c6.md @@ -0,0 +1,199 @@ +--- +id: 5f475e1c7f71a61d913836c6 +title: Step 91 +challengeType: 0 +dashedName: step-91 +--- + +# --description-- + +Aggiungi un'ultima immagine sotto l'intestazione `Desserts` usando l'url `https://cdn.freecodecamp.org/curriculum/css-cafe/pie.jpg`. Assegna all'immagine il valore `alt` di `pie icon`. + +# --hints-- + +Dovresti aggiungere un secondo elemento `img`. + +```js +assert($('img').length === 2); +``` + +Il nuovo elemento `img` dovrebbe avere un attributo `src` con il valore `https://cdn.freecodecamp.org/curriculum/css-cafe/pie.jpg`. + +```js +assert($('img').last().attr('src') === 'https://cdn.freecodecamp.org/curriculum/css-cafe/pie.jpg'); +``` + +Il nuovo elemento `img` dovrebbe avere un attributo `alt` con il valore `pie icon`. + +```js +assert($('img').last().attr('alt').match(/pie icon/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; + margin-top: 0; + margin-bottom: 15px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +img { + display: block; + margin-left: auto; + margin-right: auto; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25%; +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +.address { + margin-bottom: 5px; +} + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` + diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f47fe7e31980053a8d4403b.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f47fe7e31980053a8d4403b.md new file mode 100644 index 00000000000..83acb0d62db --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f47fe7e31980053a8d4403b.md @@ -0,0 +1,363 @@ +--- +id: 5f47fe7e31980053a8d4403b +title: Step 92 +challengeType: 0 +dashedName: step-92 +--- + +# --description-- + +Sarebbe bello se ci fosse meno spazio verticale tra gli elementi `h2` e le icone associate. Gli elementi `h2` hanno uno spazio di margine superiore e inferiore predefinito, quindi puoi modificare il margine inferiore degli elementi `h2` in `0` o in un altro numero. + +Il modo più semplice è aggiungere un margine superiore negativo agli elementi `img` per alzarli rispetto alle loro posizioni attuali. I valori negativi vengono creati utilizzando un `-` davanti al valore. Per completare questo progetto, vai avanti e usa un margine superiore negativo di `25px` nel selettore di tipo `img`. + +# --hints-- + +Dovresti assegnare alla proprietà `margin-top` il valore `-25px`. + +```js +const hasMarginTop = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-top'] === '-25px'); +assert(hasMarginTop); +``` + +Gli elementi `img` dovrebbero avere un valore `margin-top` di `-25px`. + +```js +const imgMarginTop = new __helpers.CSSHelp(document).getStyle('img')?.getPropertyValue('margin-top'); +assert(imgMarginTop === '-25px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; + margin-top: 0; + margin-bottom: 15px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +--fcc-editable-region-- +img { + display: block; + margin-left: auto; + margin-right: auto; +} +--fcc-editable-region-- + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25%; +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +.address { + margin-bottom: 5px; +} + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` + +# --solutions-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; + padding: 20px; +} + +h1 { + font-size: 40px; + margin-top: 0; + margin-bottom: 15px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +img { + display: block; + margin-left: auto; + margin-right: auto; + margin-top: -25px; +} + +hr { + height: 2px; + background-color: brown; + border-color: brown; +} + +.bottom-line { + margin-top: 25px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; + margin-top: 5px; + margin-bottom: 5px; + font-size: 18px; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25%; +} + +/* FOOTER */ + +footer { + font-size: 14px; +} + +.address { + margin-bottom: 5px; +} + +a { + color: black; +} + +a:visited { + color: black; +} + +a:hover { + color: brown; +} + +a:active { + color: brown; +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f716bee5838c354c728a7c5.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f716bee5838c354c728a7c5.md new file mode 100644 index 00000000000..41371a024c0 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f716bee5838c354c728a7c5.md @@ -0,0 +1,145 @@ +--- +id: 5f716bee5838c354c728a7c5 +title: Step 53 +challengeType: 0 +dashedName: step-53 +--- + +# --description-- + +Sotto il dessert che hai appena aggiunto, aggiungi il resto dei dessert e dei prezzi usando altri tre elementi `article`, ciascuno con due elementi `p` annidati. Ogni elemento dovrebbe avere sia il dessert e che il testo del prezzo corretti, e tutti dovrebbero avere le classi corrette. + +```bash +Cherry Pie 2.75 +Cheesecake 3.00 +Cinnamon Roll 2.50 +``` + +# --hints-- + +Dovresti avere quattro elementi `.dessert`. + +```js +assert($('.dessert').length === 4); +``` + +Dovresti avere quattro nuovi elementi `.price`. + +```js +assert($('section').last().find('.price').length === 4); +``` + +L'elemento `section` dovrebbe avere otto elementi `p`. + +```js +assert($('section').last().find('p').length === 8); +``` + +Gli elementi `.dessert` dovrebbero avere il testo `Donut`, `Cherry Pie`, `Cheesecake` e `Cinnamon Roll`. + +```js +const dessert = $('.dessert'); +assert(dessert[0].innerText.match(/donut/i)); +assert(dessert[1].innerText.match(/cherry pie/i)); +assert(dessert[2].innerText.match(/cheesecake/i)); +assert(dessert[3].innerText.match(/cinnamon roll/i)); +``` + +I nuovi elementi `.price` dovrebbero avere il testo `1.50`, `2.75`, `3.00` e `2.50`. + +```js +const prices = $('section').last().find('.price'); +assert(prices[0].innerText.match(/1\.50/)); +assert(prices[1].innerText.match(/2\.75/)); +assert(prices[2].innerText.match(/3\.00/)); +assert(prices[3].innerText.match(/2\.50/)); +``` + +Non dovresti avere spazi tra gli elementi `p`. + +```js +assert(!code.match(/<\/p>\s+

+ + + + + Cafe Menu + + + +

+ + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695197ac34f0407e339882.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695197ac34f0407e339882.md new file mode 100644 index 00000000000..e447f79bd8f --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695197ac34f0407e339882.md @@ -0,0 +1,66 @@ +--- +id: 61695197ac34f0407e339882 +title: Step 1 +challengeType: 0 +dashedName: step-1 +--- + +# --description-- + +Come hai visto nei progetti precedenti, le pagine web dovrebbero iniziare con una dichiarazione `DOCTYPE html` seguita da un elemento `html`. + +Aggiungi una dichiarazione `DOCTYPE html` in cima al documento seguita da un elemento `html`. + +# --hints-- + +Il codice dovrebbe contenere il riferimento `DOCTYPE`. + +```js +assert(code.match(/`. + +```js +assert(code.match(//gi)); +``` + +L'elemento `html` dovrebbe avere un tag di apertura. + +```js +assert(code.match(//gi)); +``` + +L'elemento `html` dovrebbe avere un tag di chiusura. + +```js +assert(code.match(/<\/html\s*>/gi)); +``` + +La dichiarazione `DOCTYPE` dovrebbe essere all'inizio del tuo HTML. + +```js +assert(__helpers.removeHtmlComments(code).match(/^\s*/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html +--fcc-editable-region-- + +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695ab9f6ffe951c16d03dd.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695ab9f6ffe951c16d03dd.md new file mode 100644 index 00000000000..43ba5783b9d --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695ab9f6ffe951c16d03dd.md @@ -0,0 +1,67 @@ +--- +id: 61695ab9f6ffe951c16d03dd +title: Step 2 +challengeType: 0 +dashedName: step-2 +--- + +# --description-- + +Annida un elemento `head` all'interno dell'elemento `html`. Subito dopo l'elemento `head`, aggiungi un elemento `body`. + +# --hints-- + +Dovresti avere un tag `head` di apertura. + +```js +assert(code.match(//i)); +``` + +Dovresti avere un tag `head` di chiusura. + +```js +assert(code.match(/<\/head\s*>/i)); +``` + +Dovresti avere un tag `body` di apertura. + +```js +assert(code.match(//i)); +``` + +Dovresti avere un tag `body` di chiusura. + +```js +assert(code.match(/<\/body\s*>/i)); +``` + +Gli elementi `head` e `body` dovrebbero essere "fratelli". + +```js +assert(document.querySelector('head')?.nextElementSibling?.localName === 'body'); +``` + +L'elemento `head` dovrebbe essere all'interno dell'elemento `html`. + +```js +assert([...document.querySelector('html')?.children].some(x => x?.localName === 'head')); +``` + +L'elemento `body` dovrebbe essere all'interno dell'elemento `html`. + +```js +assert([...document.querySelector('html')?.children].some(x => x?.localName === 'body')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +--fcc-editable-region-- + +--fcc-editable-region-- + +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695c4aad56f95497c19583.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695c4aad56f95497c19583.md new file mode 100644 index 00000000000..2f6639909e0 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695c4aad56f95497c19583.md @@ -0,0 +1,56 @@ +--- +id: 61695c4aad56f95497c19583 +title: Step 3 +challengeType: 0 +dashedName: step-3 +--- + +# --description-- + +Ricorda che l'elemento `title` fornisce ai motori di ricerca informazioni aggiuntive sulla pagina. Inoltre dice ai browser quale testo visualizzare nella barra del titolo quando la pagina è aperta, e nella scheda della pagina. + +All'interno dell'elemento `head`, annida un elemento `title` con il testo `Colored Markers`. + +# --hints-- + +Dovresti avere un tag `title` di apertura. + +```js +assert(code.match(//i)); +``` + +Dovresti avere un tag `title` di chiusura. + +```js +assert(code.match(/<\/title\s*>/i)); +``` + +Il progetto dovrebbe avere il titolo `Colored Markers`. + +```js +const title = document.querySelector('title'); +assert.equal(title?.text?.trim()?.toLowerCase(), 'colored markers') +``` + +Controlla le maiuscole/minuscole e l'ortografia del testo del titolo. + +```js +const title = document.querySelector('title'); +assert.equal(title?.text?.trim(), 'Colored Markers'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +--fcc-editable-region-- + + +--fcc-editable-region-- + + + +``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695d1fbc003856628bf561.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695d1fbc003856628bf561.md new file mode 100644 index 00000000000..7082f8fcd43 --- /dev/null +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-colors-by-building-a-set-of-colored-markers/61695d1fbc003856628bf561.md @@ -0,0 +1,52 @@ +--- +id: 61695d1fbc003856628bf561 +title: Step 4 +challengeType: 0 +dashedName: step-4 +--- + +# --description-- + +Per comunicare ai browser come codificare i caratteri sulla pagina, assegna all'attributo `charset` il valore `utf-8`. L'`utf-8` è un set di caratteri universale che include quasi tutti i caratteri di tutte le lingue. + +All'interno dell'elemento `head`, annida un elemento `meta` con l'attributo `charset` con il valore `utf-8`. Ricorda che gli elementi `meta` sono autoconcludenti e non hanno bisogno di un tag di chiusura. + +# --hints-- + +Dovresti avere un elemento `meta`. + +```js +const meta = document.querySelectorAll('meta'); +assert(meta?.length === 1); +``` + +L'elemento `meta` dovrebbe essere un elemento autoconcludente. + +```js +assert(code.match(/<\/meta>/i) === null); +``` + +L'elemento `meta` dovrebbe avere un set di caratteri `charset` con il valore `utf-8`. + +```js +const meta = [...document.querySelectorAll('meta')]; +const target = meta?.find(m => m?.getAttribute('charset')?.toLowerCase() === 'utf-8'); +assert.exists(target); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +--fcc-editable-region-- + + Colored Markers + +--fcc-editable-region-- + + + +``` diff --git a/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md b/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md index 18d2e0e846d..af57259959a 100644 --- a/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md +++ b/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md @@ -213,7 +213,9 @@ assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) プロダクトランディングページに、少なくとも 1 つのメディアクエリが使われている必要があります ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` プロダクトランディングページに、少なくとも 1 つの CSS フレックスボックスが使われている必要があります diff --git a/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md b/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md index 192ef183fe4..83c2fd093ed 100644 --- a/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md +++ b/curriculum/challenges/japanese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md @@ -222,7 +222,9 @@ assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) 技術ドキュメントのプロジェクトに、少なくとも 1 つのメディアクエリが使われている必要があります ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.md b/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.md index d04bf877f83..d6c9f739321 100644 --- a/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.md +++ b/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.md @@ -116,7 +116,9 @@ assert(!!el && el.target === '_blank') O portfólio deve usar pelo menos uma media query. ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` O elemento `#navbar` deve estar sempre na parte superior da viewport. diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md b/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md index 5e7a8c7f513..5c28d01be93 100644 --- a/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md +++ b/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.md @@ -213,7 +213,9 @@ assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) A página inicial deve ter pelo menos uma media query ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` A página inicial do produto deve utilizar o CSS flexbox pelo menos uma vez diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md b/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md index 1b7125bbdca..f1e8e1636e4 100644 --- a/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md +++ b/curriculum/challenges/portuguese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.md @@ -222,7 +222,9 @@ assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) O projeto de documentação técnica deve utilizar pelo menos uma media query ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md index 6d520e4dc7d..cfe4b17585e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md @@ -37,7 +37,7 @@ assert( ); ``` -`nonMutatingSort(globalArray)` não deve conter um array prontamente ordenado. +O conteúdo de `nonMutatingSort(globalArray)` não deve ser inserido de antemão. ```js assert(!nonMutatingSort.toString().match(/\[.*?[23569].*?\]/gs)); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 7ad02577d71..425bc6af48b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -81,7 +81,7 @@ Você não deve usar loops `for`. assert(!code.match(/for\s*?\([\s\S]*?\)/g)); ``` -A função deve retornar o valor correto após manipular `watchList` com filter, map e reduce. +Você deve retornar o resultado correto após a modificação do objeto `watchList`. ```js assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55); diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-stateless-functional-component.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-stateless-functional-component.md index e2cc07da3c9..1b184c88b6a 100644 --- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-stateless-functional-component.md +++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-stateless-functional-component.md @@ -30,7 +30,7 @@ Como um componente JSX representa HTML, você pode juntar vários componentes pa O editor de código tem uma função chamada `MyComponent`. Complete essa função para que ela retorne um único elemento `div`, que contém alguma string de texto. -**Observação:** o texto é considerado filho do elemento `div`, portanto você não poderá usar uma tag de fechamento. +**Observação:** o texto é considerado filho do elemento `div`, portanto você não poderá usar uma tag de fechamento automático. # --hints-- diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/learn-about-self-closing-jsx-tags.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/learn-about-self-closing-jsx-tags.md index 9c62f33217c..62ba704fe77 100644 --- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/learn-about-self-closing-jsx-tags.md +++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/learn-about-self-closing-jsx-tags.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d4036161 -title: Aprender sobre tags JSX com autofechamento +title: Aprender sobre tags JSX com fechamento automático challengeType: 6 forumTopicId: 301396 dashedName: learn-about-self-closing-jsx-tags @@ -10,13 +10,13 @@ dashedName: learn-about-self-closing-jsx-tags Até agora, você viu como o JSX difere do HTML de uma forma importante com o uso de `className` em vez de `class` para definir classes HTML. -Outra forma importante em que o JSX difere do HTML é na ideia da tag de autofechamento. +Outra forma importante em que o JSX difere do HTML é na ideia da tag de fechamento automático. -Em HTML, quase todas as tags possuem uma tag de abertura e fechamento: `
`; a tag de fechamento sempre tem uma barra para frente antes do nome da tag que está fechando. No entanto, há instâncias especiais no HTML chamadas de "tags de autofechamento", ou tags que não requerem uma tag de abertura e fechamento antes que outra tag possa iniciar. +Em HTML, quase todas as tags possuem uma tag de abertura e fechamento: `
`; a tag de fechamento sempre tem uma barra para frente antes do nome da tag que está fechando. No entanto, há instâncias especiais no HTML chamadas de "tags de fechamento automático", ou tags que não requerem uma tag de abertura e fechamento antes que outra tag possa iniciar. Por exemplo, a tag de quebra de linha pode ser escrita como `
` ou como `
`, mas nunca deve ser escrita como `

`, uma vez que não contém nenhum conteúdo. -Em JSX, as regras são um pouco diferentes. Qualquer elemento JSX pode ser escrito com uma tag autofechada, e todo elemento deve ser fechado. A tag de quebra de linha, por exemplo, deve sempre ser escrita como `
` para ser JSX válido que pode ser transpilado. Um `
`, por outro lado, pode ser escrito como `
` ou `
`. A diferença é que na primeira versão de sintaxe não há como incluir nada no `
`. Você verá em desafios posteriores que essa sintaxe é útil ao renderizar componentes React. +Em JSX, as regras são um pouco diferentes. Qualquer elemento JSX pode ser escrito com uma tag de fechamento automático, e todo elemento deve ser fechado. A tag de quebra de linha, por exemplo, deve sempre ser escrita como `
` para ser JSX válido que pode ser transpilado. Um `
`, por outro lado, pode ser escrito como `
` ou `
`. A diferença é que na primeira versão de sintaxe não há como incluir nada no `
`. Você verá em desafios posteriores que essa sintaxe é útil ao renderizar componentes React. # --instructions-- diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-22-names-scores.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-22-names-scores.md index 688bc921bc5..3cee0ada20c 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-22-names-scores.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-22-names-scores.md @@ -8,7 +8,7 @@ dashedName: problem-22-names-scores # --description-- -Neste desafio, existe uma variável chamada `names`, que possui um array com mais de 5 mil nomes. Você pode acessá-la através do argumento passado para sua função. A primeira coisa que você precisa fazer é ordenar estes nomes alfabeticamente. Em seguida, descubra a posição de cada letra do nome e some todas as posições. Após calcular a soma, multiplique este valor pela posição do nome dentro do array de nomes. +Usando `names`, um array em segundo plano contendo mais de 5 mil nomes, a primeira coisa que você precisa fazer é ordenar estes nomes alfabeticamente. Em seguida, descubra a posição de cada letra do nome e some todas as posições. Após calcular a soma, multiplique este valor pela posição do nome dentro do array de nomes. Por exemplo, após ordenar a lista alfabeticamente, o nome COLIN, cujas letras valem 3 + 15 + 12 + 9 + 14 = 53, é o 938º nome na lista. Portanto, o nome COLIN obteria a pontuação de 938 × 53 = 49714. diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md index d04bf877f83..d6c9f739321 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-personal-portfolio-webpage-project/build-a-personal-portfolio-webpage.md @@ -116,7 +116,9 @@ assert(!!el && el.target === '_blank') O portfólio deve usar pelo menos uma media query. ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` O elemento `#navbar` deve estar sempre na parte superior da viewport. diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md index 7efc68d4994..e08f25e36a7 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-product-landing-page-project/build-a-product-landing-page.md @@ -213,7 +213,9 @@ assert(!!el && top1 >= -15 && top1 <= 15 && top2 >= -15 && top2 <= 15) A página inicial deve ter pelo menos uma media query. ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` A página inicial do produto deve utilizar o CSS flexbox pelo menos uma vez. diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md index 27c05ad0d89..a91acada56e 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/build-a-technical-documentation-page-project/build-a-technical-documentation-page.md @@ -222,7 +222,9 @@ assert(!!el && left1 >= -15 && left1 <= 15 && left2 >= -15 && left2 <= 15) O projeto de documentação técnica deve utilizar pelo menos uma media query. ```js -assert.isAtLeast(new __helpers.CSSHelp(document).getCSSRules('media')?.length, 1); +const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media')) +const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media') +assert(cssCheck.length > 0 || htmlSourceAttr.length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md index f5b762e924b..694e1259c4f 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md @@ -35,7 +35,7 @@ O elemento `p` deve estar abaixo do elemento `h1`. assert($('p')[0].previousElementSibling.tagName === 'H1'); ``` -O elemento `p` deve ter o texto `Est. 2020`. +O elemento `p` deve conter o texto `Est. 2020`. ```js assert(code.match(/

Est. 2020<\/p>/i)); diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344f9c805cd193c33d829c.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344f9c805cd193c33d829c.md index feb1ecd69d6..556fdd4aed7 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344f9c805cd193c33d829c.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344f9c805cd193c33d829c.md @@ -26,7 +26,7 @@ const hasSelector = new __helpers.CSSHelp(document).getStyle('h1'); assert(hasSelector); ``` -Sua propriedade `text-align` deve definir um valor de `center`. +Sua propriedade `text-align` deve ter um valor de `center`. ```js const hasTextAlign = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['text-align'] === 'center'); diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3cade9993019e26313fa8e.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3cade9993019e26313fa8e.md new file mode 100644 index 00000000000..78c7355aaf2 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3cade9993019e26313fa8e.md @@ -0,0 +1,119 @@ +--- +id: 5f3cade9993019e26313fa8e +title: Passo 43 +challengeType: 0 +dashedName: step-43 +--- + +# --description-- + +Agora que você sabe que funciona, você pode alterar os elementos `article` e `p` restantes para corresponderem ao primeiro conjunto. Comece adicionando a classe `item` ao outro elemento `article`. + +# --hints-- + +Você deve ter cinco elementos `article`. + +```js +assert($('article').length === 5); +``` + +Você deve ter cinco elementos `.item`. + +```js +assert($('.item').length === 5); +``` + +O elemento `.item` deve estar dentro do elemento `article`. + + +```js +const articles = $('article'); +const items = $('.item'); +assert(articles[0] === items[0]); +assert(articles[1] === items[1]); +assert(articles[2] === items[2]); +assert(articles[3] === items[3]); +assert(articles[4] === items[4]); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + +

+ + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; +} + +.item p { + display: inline-block; +} + +.flavor { + text-align: left; + width: 50%; +} + +.price { + text-align: right; + width: 50%; +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e01f288a026d709587.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e01f288a026d709587.md new file mode 100644 index 00000000000..540a214be75 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e01f288a026d709587.md @@ -0,0 +1,158 @@ +--- +id: 5f3ef6e01f288a026d709587 +title: Passo 67 +challengeType: 0 +dashedName: step-67 +--- + +# --description-- + +Você pode usar um elemento `hr` para exibir um divisor entre seções de conteúdo diferente. + +Primeiro, adicione um elemento `hr` entre o primeiro elemento `header` e o elemento `main`. Observe que os elementos `hr` fecham em si mesmos. + +# --hints-- + +Você deve adicionar um elemento `hr`. Observe que os elementos `hr` fecham em si mesmos. + +```js +assert(code.match(//i)); +assert(!code.match(/<\/hr>/i)); +``` + +Você deve manter o elemento `header` preexistente. + +```js +assert($('header').length === 1); +``` + +O elemento preexistente `main` deve permanecer o mesmo. + +```js +assert($('main').length === 1); +``` + +O elemento `hr` deve estar entre os elementos `header` e `main`. + +```js +assert($('hr')[0].previousElementSibling.tagName === 'HEADER'); +assert($('hr')[0].nextElementSibling.tagName === 'MAIN'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e03d719d5ac4738993.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e03d719d5ac4738993.md new file mode 100644 index 00000000000..050f7c8be65 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e03d719d5ac4738993.md @@ -0,0 +1,122 @@ +--- +id: 5f3ef6e03d719d5ac4738993 +title: Passo 57 +challengeType: 0 +dashedName: step-57 +--- + +# --description-- + +A largura atual do menu sempre ocupará 80% da largura do elemento `body`. Em uma tela muito ampla, o café e a sobremesa aparecem muito distantes de seus preços. + +Adicione uma propriedade `max-width` ao `menu` com um valor de `500px` para evitar esse distanciamento em excesso. + +# --hints-- + +Você deve definir a propriedade `max-width` para `500px`. + +```js +const hasMaxWidth = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['max-width'] === '500px'); +assert(hasMaxWidth); +``` + +O elemento `.menu` deve ter um `max-width` com o valor de `500px`. + +```js +const menuMaxWidth = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('max-width'); +assert(menuMaxWidth === '500px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +--fcc-editable-region-- +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0a81099d9a697b550.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0a81099d9a697b550.md new file mode 100644 index 00000000000..d07c14a5a48 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0a81099d9a697b550.md @@ -0,0 +1,156 @@ +--- +id: 5f3ef6e0a81099d9a697b550 +title: Passo 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +Dentro do `footer`, adicione um elemento `p`. Então, aninhe um elemento de âncora (`a`) no `p` que encaminhe para `https://www.freecodecamp.org` e tenha o texto `Visit our website`. + +# --hints-- + +O elemento preexistente `footer` deve permanecer o mesmo. + +```js +assert($('footer').length === 1); +``` + +O novo elemento `p` deve estar dentro do novo elemento `footer`. + +```js +assert($('footer').children('p').length === 1); +``` + +Seu elemento `a` deve estar dentro de seu novo elemento `p`. + +```js +assert($('footer').children('p').children('a').length === 1); +``` + +O novo elemento `a` deve ter o texto `Visit our website`. + +```js +assert($('footer').find('a')[0].innerText.match(/Visit our website/i)); +``` + +O novo elemento de âncora (`a`) deve fazer um link para `https://www.freecodecamp.org`. Lembre-se de que elementos `a` usam o atributo `href` para criar um link. + +```js +assert($('footer').find('a').attr('href') === 'https://www.freecodecamp.org'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0b431cc215bb16f55.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0b431cc215bb16f55.md new file mode 100644 index 00000000000..ad89aced61f --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0b431cc215bb16f55.md @@ -0,0 +1,141 @@ +--- +id: 5f3ef6e0b431cc215bb16f55 +title: Passo 66 +challengeType: 0 +dashedName: step-66 +--- + +# --description-- + +Adicione um segundo elemento `p` abaixo do link e dê a ele o texto `123 Free Code Camp Drive`. + +# --hints-- + +Você deve adicionar um segundo elemento `p` ao seu `footer`. + +```js +assert($('footer').children('p').length === 2); +``` + +O novo elemento `p` deve ter o texto `123 Free Code Camp Drive`. Certifique-se de que seu novo elemento venha após seu elemento existente. + +```js +assert($('footer').children('p').last().text().match(/123 Free Code Camp Drive/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1 { + font-size: 40px; +} + +h2 { + font-size: 30px; +} + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e0c3feaebcf647ad.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e0c3feaebcf647ad.md new file mode 100644 index 00000000000..33eadf30d12 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e0c3feaebcf647ad.md @@ -0,0 +1,110 @@ +--- +id: 5f3ef6e0e0c3feaebcf647ad +title: Passo 48 +challengeType: 0 +dashedName: step-48 +--- + +# --description-- + +Adicione um elemento `h2` na nova seção e dê a ele o texto `Desserts`. + +# --hints-- + +Você deve manter o elemento `section` preexistente. + +```js +assert($('section').length === 2); +``` + +Você deve adicionar um elemento `h2` dentro do segundo elemento `section`. + +```js +assert($('section')[1].children[0].tagName === 'H2'); +``` + +O novo elemento `h2` deve conter o texto `Desserts`. + +```js +assert($('h2')[1].innerText.match(/Desserts/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; +} + +.item p { + display: inline-block; +} + +.flavor { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e9629bad967cd71e.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e9629bad967cd71e.md new file mode 100644 index 00000000000..78f07f51cc8 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0e9629bad967cd71e.md @@ -0,0 +1,121 @@ +--- +id: 5f3ef6e0e9629bad967cd71e +title: Passo 60 +challengeType: 0 +dashedName: step-60 +--- + +# --description-- + +Você pode adicionar um valor de fallback para a font-family adicionando outro nome de fonte separado por uma vírgula. Os fallbacks são usados em instâncias onde a fonte inicial não é encontrada ou não está disponível. + +Adicione a fonte de fallback `serif` após a fonte `Impact`. + +# --hints-- + +Você deve adicionar `serif` como fallback para a fonte `Impact`. + +```js +const fontFamily = new __helpers.CSSHelp(document).getStyle('h1, h2')?.getPropertyValue('font-family'); +assert(fontFamily === 'Impact, serif'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +--fcc-editable-region-- +h1, h2 { + font-family: Impact; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0eaa7da26e3d34d78.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0eaa7da26e3d34d78.md new file mode 100644 index 00000000000..d5d144e7e3e --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0eaa7da26e3d34d78.md @@ -0,0 +1,135 @@ +--- +id: 5f3ef6e0eaa7da26e3d34d78 +title: Passo 54 +challengeType: 0 +dashedName: step-54 +--- + +# --description-- + +Você pode dar ao seu menu um pouco mais de espaço entre o conteúdo e os lados com várias propriedades `padding`. + +Dê à classe `menu` um `padding-left` e um `padding-right` com o mesmo valor de `20px`. + +# --hints-- + +Você deve definir a propriedade `padding-left` para `20px`. + +```js +const hasPaddingLeft = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['padding-left'] === '20px'); +assert(hasPaddingLeft); +``` + +Você deve definir a propriedade `padding-right` para `20px`. + +```js +const hasPaddingRight = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['padding-right'] === '20px'); +assert(hasPaddingRight); +``` + +O elemento `.menu` deve ter um `padding-left` com o valor de `20px`. + +```js +const menuPaddingLeft = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-left'); +assert(menuPaddingLeft === '20px'); +``` + +O elemento `.menu` deve ter um `padding-right` com o valor de `20px`. + +```js +const menuPaddingRight = new __helpers.CSSHelp(document).getStyle('.menu')?.getPropertyValue('padding-right'); +assert(menuPaddingRight === '20px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); +} + +h1, h2, p { + text-align: center; +} + +--fcc-editable-region-- +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; +} +--fcc-editable-region-- + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0f8c230bdd2349716.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0f8c230bdd2349716.md new file mode 100644 index 00000000000..21d0047a359 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3ef6e0f8c230bdd2349716.md @@ -0,0 +1,147 @@ +--- +id: 5f3ef6e0f8c230bdd2349716 +title: Passo 63 +challengeType: 0 +dashedName: step-63 +--- + +# --description-- + +A tipografia dos elementos do cabeçalho (por exemplo, `h1`, `h2`) é definida por valores padrão dos navegadores dos usuários. + +Adicione dois novos seletores de tipo (`h1` e `h2`). Use a propriedade `font-size` para ambos, mas use o valor de `40px` para `h1` e `30px` para o `h2`. + +# --hints-- + +Você deve usar o seletor `h1`. + +```js +const hasH1 = new __helpers.CSSHelp(document).getStyle('h1'); +assert(hasH1); +``` + +Você deve usar o seletor `h2`. + +```js +const hasH2 = new __helpers.CSSHelp(document).getStyle('h2'); +assert(hasH2); +``` + +O elemento `h1` deve ter seu `font-size` com o valor de `40px`. + +```js +const h1FontSize = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('font-size'); +assert(h1FontSize === '40px'); +``` + +O elemento `h2` deve ter seu `font-size` com o valor de `30px`. + +```js +const h2FontSize = new __helpers.CSSHelp(document).getStyle('h2')?.getPropertyValue('font-size'); +assert(h2FontSize === '30px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + Cafe Menu + + + + + + +``` + +```css +body { + background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg); + font-family: sans-serif; +} + +--fcc-editable-region-- + +--fcc-editable-region-- + +.established { + font-style: italic; +} + +h1, h2, p { + text-align: center; +} + +.menu { + width: 80%; + background-color: burlywood; + margin-left: auto; + margin-right: auto; + padding: 20px; + max-width: 500px; +} + +h1, h2 { + font-family: Impact, serif; +} + +.item p { + display: inline-block; +} + +.flavor, .dessert { + text-align: left; + width: 75%; +} + +.price { + text-align: right; + width: 25% +} +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc23f9bf86c76b9248c6eba.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc23f9bf86c76b9248c6eba.md new file mode 100644 index 00000000000..c5eb857c7c0 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc23f9bf86c76b9248c6eba.md @@ -0,0 +1,61 @@ +--- +id: 5dc23f9bf86c76b9248c6eba +title: Passo 7 +challengeType: 0 +dashedName: step-7 +--- + +# --description-- + +Você pode adicionar imagens a um site da web usando o elemento `img`. Elementos `img` têm uma tag de abertura, mas não têm a tag de fechamento. A tag de um elemento que não precisa de uma tag de fechamento é conhecida como tag de fechamento automático. + +Adicione um elemento `img` abaixo do elemento `p`. Neste momento, nenhuma imagem será exibida no navegador. + +# --hints-- + +O elemento `img` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('img')); +``` + +O elemento `img` não deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(!code.match(/<\/img\>/)); +``` + +Você deve ter apenas um elemento `img`. Remova os elementos adicionais. + +```js +assert(document.querySelectorAll('img').length === 1); +``` + +O elemento `img` deve estar abaixo do elemento `p`. Eles estão na ordem errada. + +```js +const collection = [...document.querySelectorAll('p,img')].map( + (node) => node.nodeName +); +assert(collection.indexOf('P') < collection.indexOf('IMG')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+

Cat Photos

+ +--fcc-editable-region-- +

Click here to view more cat photos.

+--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24073f86c76b9248c6ebb.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24073f86c76b9248c6ebb.md new file mode 100644 index 00000000000..aa3c9558256 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24073f86c76b9248c6ebb.md @@ -0,0 +1,59 @@ +--- +id: 5dc24073f86c76b9248c6ebb +title: Passo 8 +challengeType: 0 +dashedName: step-8 +--- + +# --description-- + +Atributos em HTML são palavras especiais usadas dentro da tag de abertura de um elemento para controlar o comportamento dele. O atributo `src` em um elemento `img` especifica o URL da imagem (onde a imagem está localizada). Um exemplo de um elemento `img` usando o atributo `src` é: ``. + +Adicione um atributo `src` ao elemento `img` existente, definindo-o com o seguinte URL: `https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg`. + +# --hints-- + +O código deve ter um elemento `img`. Você pode ter removido o elemento `img` ou não cercou o valor do atributo `src` com aspas. + +```js +assert(document.querySelector('img')); +``` + +O elemento `img` deve ter um atributo `src`. Você omitiu o atributo ou tem um erro de digitação. Certifique-se de que haja um espaço entre o nome do elemento e o nome do atributo. + +```js +assert(document.querySelector('img').src); +``` + +O atributo `src` do elemento `img` deve estar definido como '`https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg`'. Você omitiu o URL ou tem um erro de digitação. As verificações distinguem maiúsculas e minúsculas no URL. + +```js +assert(document.querySelector('img').src === 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg'); +``` + +Embora você tenha definido o `src` do elemento `img` com o URL correto, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\ + +

CatPhotoApp

+
+

Cat Photos

+ +

Click here to view more cat photos.

+--fcc-editable-region-- + +--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24165f86c76b9248c6ebc.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24165f86c76b9248c6ebc.md new file mode 100644 index 00000000000..b96a81ac368 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24165f86c76b9248c6ebc.md @@ -0,0 +1,57 @@ +--- +id: 5dc24165f86c76b9248c6ebc +title: Passo 9 +challengeType: 0 +dashedName: step-9 +--- + +# --description-- + +Todos os elementos `img` devem ter um atributo `alt`. O texto de um atributo `alt` é usado por leitores de tela para melhorar a acessibilidade. Ele é exibido se a imagem não puder ser carregada. Por exemplo, `A cat` tem um atributo `alt` com o texto `A cat`. + +Adicione um atributo `alt` ao elemento `img` com o texto `A cute orange cat lying on its back`. + +# --hints-- + +O código deve ter um elemento `img`. Você removeu o elemento `img` de um passo anterior. + +```js +assert(document.querySelector('img')); +``` + +O elemento `img` não tem um atributo `alt`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert(document.querySelector('img').hasAttribute('alt')); +``` + +O valor do atributo `alt` do elemento `img` está definido com outro valor que não é 'A cute orange cat lying on its back'. Certifique-se de que o valor do atributo `alt` esteja cercado com aspas. + +```js +const altText = document + .querySelector('img') + .alt.toLowerCase() + .replace(/\s+/g, ' '); +assert(altText.match(/A cute orange cat lying on its back\.?$/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+

Cat Photos

+ +

Click here to view more cat photos.

+--fcc-editable-region-- + +--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24614f86c76b9248c6ebd.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24614f86c76b9248c6ebd.md new file mode 100644 index 00000000000..33aaeb31cff --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc24614f86c76b9248c6ebd.md @@ -0,0 +1,79 @@ +--- +id: 5dc24614f86c76b9248c6ebd +title: Passo 10 +challengeType: 0 +dashedName: step-10 +--- + +# --description-- + +Você pode fazer uma ligação com outra página usando o elemento de âncora (`a`). Por exemplo, `` faria um link para `freecodecamp.org`. + +Adicione um elemento de âncora após o parágrafo que faça um link para `https://freecatphotoapp.com`. Neste momento, o link não será exibido na pré-visualização. + +# --hints-- + +O elemento de âncora (`a`) deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('a')); +``` + +O elemento de âncora (`a`) deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/a\>/)); +``` + +O elemento de âncora (`a`) deve estar abaixo do elemento `p`. Eles estão na ordem errada. + +```js +const collection = [...document.querySelectorAll('a, p')].map( + (node) => node.nodeName +); +assert(collection.indexOf('P') < collection.indexOf('A')); +``` + +O elemento de âncora (`a`) não tem um atributo `href`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert(document.querySelector('a').hasAttribute('href')); +``` + +O elemento de âncora (`a`) deve fazer um link para `https://freecatphotoapp.com`. Você omitiu o URL ou tem um erro de digitação. + +```js +assert( + document.querySelector('a').getAttribute('href') === + 'https://freecatphotoapp.com' +); +``` + +Embora você tenha definido o atributo `href` do elemento de âncora ('a') com o link correto, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert( + !/\ + +

CatPhotoApp

+
+

Cat Photos

+ +--fcc-editable-region-- +

Click here to view more cat photos.

+--fcc-editable-region-- + A cute orange cat lying on its back. +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ddbd81294d8ddc1510a8e56.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ddbd81294d8ddc1510a8e56.md new file mode 100644 index 00000000000..a4b1ca0de01 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ddbd81294d8ddc1510a8e56.md @@ -0,0 +1,57 @@ +--- +id: 5ddbd81294d8ddc1510a8e56 +title: Passo 11 +challengeType: 0 +dashedName: step-11 +--- + +# --description-- + +O texto de um link deve ser colocado entre as tags de abertura e fechamento de um elemento de âncora (`a`). Por exemplo, `click here to go to freeCodeCamp.org` é um link com o texto `click here to go to freeCodeCamp.org`. + +Adicione o texto `cat photos` ao elemento de âncora. Ele se tornará o texto do link. + +# --hints-- + +O elemento de âncora (`a`) deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('a')); +``` + +O elemento de âncora (`a`) deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/a\>/)); +``` + +O elemento de âncora (`a`) deve conter o texto `cat photos`. Certifique-se de colocar o texto do link entre as tags de abertura e de fechamentoa do elemento de âncora (`a`). + +```js +assert( + document.querySelector('a').innerText.toLowerCase().replace(/\s+/g, ' ') === + 'cat photos' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+

Cat Photos

+ +

Click here to view more cat photos.

+--fcc-editable-region-- + +--fcc-editable-region-- + A cute orange cat lying on its back. +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa22d1b521be39a3de7be0.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa22d1b521be39a3de7be0.md new file mode 100644 index 00000000000..d1323a36054 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa22d1b521be39a3de7be0.md @@ -0,0 +1,66 @@ +--- +id: 5dfa22d1b521be39a3de7be0 +title: Passo 12 +challengeType: 0 +dashedName: step-12 +--- + +# --description-- + +Transforme as palavras `cat photos` localizadas dentro do elemento `p` em um link, substituindo as palavras pelo elemento de âncora adicionado anteriormente. O elemento `p` deve mostrar o mesmo texto no navegador, mas as palavras `cat photos` agora devem ser um link. Deve haver apenas um link aparecendo no aplicativo. + +# --hints-- + +O código deve conter apenas um elemento de âncora (`a`). Remova os elemento elementos de âncora adicionais. + +```js +assert(document.querySelectorAll('a').length === 1); +``` + +O elemento de âncora (`a`) deve estar aninhado dentro do elemento `p`. + +```js +assert($('p > a').length); +``` + +O texto do link deve ser `cat photos`. Você omitiu o texto ou tem um erro de digitação. + +```js +const nestedAnchor = $('p > a')[0]; +assert( + nestedAnchor.getAttribute('href') === 'https://freecatphotoapp.com' && + nestedAnchor.innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos' +); +``` + +Após aninhar o elemento de âncora (`a`), o único conteúdo do elemento `p` visível no navegador deve ser `Click here to view more cat photos.` Verifique o texto novamente em termos de espaçamento e pontuação, tanto do elemento `p` quanto do elemento de âncora aninhado. + +```js +const pText = document + .querySelector('p') + .innerText.toLowerCase() + .replace(/\s+/g, ' '); +assert(pText.match(/click here to view more cat photos\.?$/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+

Cat Photos

+ +--fcc-editable-region-- +

Click here to view more cat photos.

+ cat photos +--fcc-editable-region-- + A cute orange cat lying on its back. +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa2407b521be39a3de7be1.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa2407b521be39a3de7be1.md new file mode 100644 index 00000000000..fbcb1bbc756 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa2407b521be39a3de7be1.md @@ -0,0 +1,55 @@ +--- +id: 5dfa2407b521be39a3de7be1 +title: Passo 13 +challengeType: 0 +dashedName: step-13 +--- + +# --description-- + +Adicione um atributo `target` com o valor `_blank` à tag de abertura do elemento de âncora (`a`) para que o link seja aberto em uma nova guia. + +# --hints-- + +O elemento `p` deve ter um elemento de âncora (`a`) aninhado com o texto `cat photos`. Você pode ter excluído o elemento ou ter um erro de digitação. + +```js +const anchor = $('p > a'); +assert( + anchor.length && + anchor[0].innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos' +); +``` + +O elemento de âncora (`a`) não tem um atributo `target`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert(document.querySelector('a').hasAttribute('target')); +``` + +O valor do atributo `target` deve ser `_blank`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert(document.querySelector('a').getAttribute('target') === '_blank'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+

Cat Photos

+ +--fcc-editable-region-- +

Click here to view more cat photos.

+--fcc-editable-region-- + A cute orange cat lying on its back. +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa30b9eacea3f48c6300ad.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa30b9eacea3f48c6300ad.md new file mode 100644 index 00000000000..8c0a433776b --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa30b9eacea3f48c6300ad.md @@ -0,0 +1,88 @@ +--- +id: 5dfa30b9eacea3f48c6300ad +title: Passo 14 +challengeType: 0 +dashedName: step-14 +--- + +# --description-- + +Transforme a imagem em um link, envolvendo-a com as tags dos elementos necessários. Use `https://freecatphotoapp.com` como valor do atributo `href` do elemento de âncora. + +# --hints-- + +O valor do atributo `src` do elemento `img` deve estar definido como `https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg`. Você pode tê-lo excluído acidentalmente. + +```js +assert( + document.querySelector('img') && + document.querySelector('img').getAttribute('src') === + 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg' +); +``` + +O elemento de âncora (`a`) deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('a').length >= 2); +``` + +Você deve adicionar apenas uma tag de abertura para o elemento de âncora (`a`). Remova as tags adicionais. + +```js +assert(document.querySelectorAll('a').length === 2); +``` + +O elemento de âncora (`a`) deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/a>/g).length >= 2); +``` + +Você deve adicionar apenas uma tag de fechamento para o elemento de âncora (`a`). Remova as tags adicionais. + +```js +assert(code.match(/<\/a>/g).length === 2); +``` + +O elemento de âncora (`a`) não tem um atributo `href`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert(document.querySelector('a').hasAttribute('href')); +``` + +O elemento de âncora (`a`) deve fazer um link para `https://freecatphotoapp.com`. Você omitiu o URL ou tem um erro de digitação. + +```js +assert( + document.querySelectorAll('a')[1].getAttribute('href') === + 'https://freecatphotoapp.com' +); +``` + +O elemento `img` deve estar dentro do elemento de âncora (`a`). Todo o elemento `img` deve estar dentro das tags de abertura e fechamento do elemento de âncora (`a`). + +```js +assert(document.querySelector('img').parentNode.nodeName === 'A'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+

Cat Photos

+ +

Click here to view more cat photos.

+--fcc-editable-region-- + A cute orange cat lying on its back. +--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa3589eacea3f48c6300ae.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa3589eacea3f48c6300ae.md new file mode 100644 index 00000000000..9f6a3b5b495 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa3589eacea3f48c6300ae.md @@ -0,0 +1,75 @@ +--- +id: 5dfa3589eacea3f48c6300ae +title: Passo 17 +challengeType: 0 +dashedName: step-17 +--- + +# --description-- + +Dentro do segundo elemento `section`, adicione um novo elemento `h2` com o texto `Cat Lists`. + +# --hints-- + +O elemento `section` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert( + document.querySelectorAll('section').length === 2 && + code.match(/<\/section>/g).length === 2 +); +``` + +O elemento `h2` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('h2').length === 2); +``` + +O elemento `h2` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/h2\>/g).length === 2); +``` + +O segundo elemento `h2` deve estar logo acima da tag de fechamento do segundo elemento `section`. Ele não está na posição correta. + +```js +const secondSection = document.querySelectorAll('section')[1]; +assert(secondSection.lastElementChild.nodeName === 'H2'); +``` + +O segundo elemento `h2` deve ter o texto `Cat Lists`. Você omitiu o texto ou tem um erro de digitação. + +```js +assert( + document + .querySelectorAll('main > section')[1] + .lastElementChild.innerText.toLowerCase() === 'cat lists' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+--fcc-editable-region-- +
+
+--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa371beacea3f48c6300af.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa371beacea3f48c6300af.md new file mode 100644 index 00000000000..3047a6bb9c4 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa371beacea3f48c6300af.md @@ -0,0 +1,82 @@ +--- +id: 5dfa371beacea3f48c6300af +title: Passo 18 +challengeType: 0 +dashedName: step-18 +--- + +# --description-- + +Quando você adiciona um elemento de título menor à página, é implícito que você está iniciando uma nova subseção. + +Depois do último elemento `h2` do segundo elemento `section`, adicione um elemento `h3` com o texto `Things cats love:`. + +# --hints-- + +O segundo elemento `section` parece não ter a tag de abertura, a de fechamento ou as duas tags. + +```js +assert( + document.querySelectorAll('main > section')[1] && + code.match(/\<\/section>/g).length == 2 +); +``` + +O elemento `h3` deve estar logo acima da tag de fechamento de fechamento do segundo elemento `section`. + +```js +assert( + document.querySelectorAll('main > section')[1].lastElementChild.nodeName === + 'H3' +); +``` + +O elemento `h3` logo acima da tag de fechamento do segundo elemento `section` deve ter o texto `Things cats love:`. Certifique-se de incluir os dois pontos ao final do texto. + +```js +assert( + document + .querySelectorAll('main > section')[1] + .lastElementChild.innerText.toLowerCase() + .replace(/\s+/g, ' ') === 'things cats love:' +); +``` + +Deve haver um elemento `h2` com o texto `Cat Lists` acima do último elemento `h3` que está aninhado no último elemento `section`. Você pode ter excluído o elemento `h2` acidentalmente. + +```js +const secondSectionLastElemNode = document.querySelectorAll('main > section')[1] + .lastElementChild; +assert( + secondSectionLastElemNode.nodeName === 'H3' && + secondSectionLastElemNode.previousElementSibling.innerText + .toLowerCase() + .replace(/\s+/g, ' ') === 'cat lists' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+--fcc-editable-region-- +
+

Cat Lists

+
+--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa37b9eacea3f48c6300b0.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa37b9eacea3f48c6300b0.md new file mode 100644 index 00000000000..1fc0cc6c11a --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa37b9eacea3f48c6300b0.md @@ -0,0 +1,58 @@ +--- +id: 5dfa37b9eacea3f48c6300b0 +title: Passo 19 +challengeType: 0 +dashedName: step-19 +--- + +# --description-- + +Após o elemento `h3` com o texto `Things cats love:`, adicione um elemento de lista não ordenada (`ul`). Observe que nada será exibido neste momento. + +# --hints-- + +O elemento `ul` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('ul')); +``` + +O elemento `ul` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/ul>/)); +``` + +O elemento `ul` deve estar acima da tag de fechamento do segundo elemento `section`. + +```js +const secondSectionLastElemNode = $('main > section')[1].lastElementChild; +assert(secondSectionLastElemNode.nodeName === 'UL'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+--fcc-editable-region-- +

Cat Lists

+

Things cats love:

+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb5ecbeacea3f48c6300b1.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb5ecbeacea3f48c6300b1.md new file mode 100644 index 00000000000..1d8ea40171b --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb5ecbeacea3f48c6300b1.md @@ -0,0 +1,77 @@ +--- +id: 5dfb5ecbeacea3f48c6300b1 +title: Passo 20 +challengeType: 0 +dashedName: step-20 +--- + +# --description-- + +Use elementos de item de lista (`li`) para criar itens em uma lista. Aqui está um exemplo de itens de lista em uma lista não ordenada: + +```html +
    +
  • milk
  • +
  • cheese
  • +
+``` + +Aninhe três itens de lista dentro do elemento `ul` para exibir três coisas que os gatos adoram: `cat nip`, `laser pointers` e `lasagna`. + +# --hints-- + +Você deve ter três elementos `li`. Cada elemento `li` deve ter sua própria tag de abertura e de fechamento. + +```js +assert($('li').length === 3 && code.match(/<\/li\>/g).length === 3); +``` + +Você deve ter os três elementos `li` com os textos `cat nip`, `laser pointers` e `lasagna`, não importando a ordem. Você omitiu algum dos textos ou tem um erro de digitação. + +```js +assert.deepStrictEqual( + [...document.querySelectorAll('li')] + .map((item) => item.innerText.toLowerCase()) + .sort((a, b) => a.localeCompare(b)), + ['cat nip', 'lasagna', 'laser pointers'] +); +``` + +Os três elementos `li` devem estar localizados entre as tags de abertura e fechamento do elemento `ul`. + +```js +assert( + [...document.querySelectorAll('li')].filter( + (item) => item.parentNode.nodeName === 'UL' + ).length === 3 +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+--fcc-editable-region-- +
    +
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6250eacea3f48c6300b2.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6250eacea3f48c6300b2.md new file mode 100644 index 00000000000..512a8fa4e2c --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6250eacea3f48c6300b2.md @@ -0,0 +1,88 @@ +--- +id: 5dfb6250eacea3f48c6300b2 +title: Passo 21 +challengeType: 0 +dashedName: step-21 +--- + +# --description-- + +Depois da lista não ordenada, adicione uma nova imagem com o valor do atributo `src` definido como `https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg` e o valor do atributo `alt` definido como `A slice of lasagna on a plate.` + +# --hints-- + +Deve haver um elemento `img` logo após a tag de fechamento ``. + +```js +assert($('section')[1].lastElementChild.nodeName === 'IMG'); +``` + +A nova imagem não tem um atributo `alt`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('section')[1].lastElementChild.hasAttribute('alt')); +``` + +A nova imagem deve ter o valor de `alt` como sendo `A slice of lasagna on a plate.` Certifique-se de que o valor de `alt` do atributo esteja cercado com aspas. + +```js +assert( + $('section')[1] + .lastElementChild.getAttribute('alt') + .replace(/\s+/g, ' ') + .match(/^A slice of lasagna on a plate\.?$/i) +); +``` + +A nova imagem não tem um atributo `src`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('section')[1].lastElementChild.hasAttribute('src')); +``` + +A nova imagem deve ter um valor de `src` de `https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg`. Certifique-se de que o valor do atributo `src` esteja cercado com aspas. + +```js +assert( + $('section')[1].lastElementChild.getAttribute('src') === + 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg' +); +``` + +Embora você tenha definido o valor de `src` com o URL correto, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\ + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+--fcc-editable-region-- +
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb655eeacea3f48c6300b3.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb655eeacea3f48c6300b3.md new file mode 100644 index 00000000000..70b6140f169 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb655eeacea3f48c6300b3.md @@ -0,0 +1,76 @@ +--- +id: 5dfb655eeacea3f48c6300b3 +title: Passo 22 +challengeType: 0 +dashedName: step-22 +--- + +# --description-- + +O elemento `figure` representa um conteúdo auto-contido e permitirá que você associe uma imagem com uma legenda. + +Aninhe a imagem que você acabou de adicionar dentro de um elemento `figure`. + +# --hints-- + +O elemento `figure` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelector('figure')); +``` + +O elemento `figure` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/figure\>/)); +``` + +O elemento `figure` deve estar logo acima da tag de fechamento de fechamento do segundo elemento `section`. + +```js +assert($('section')[1].lastElementChild.nodeName === 'FIGURE'); +``` + +O elemento `img` da lasanha deve estar dentro do elemento `figure`. + +```js +assert( + document.querySelector('figure > img') && + document.querySelector('figure > img').getAttribute('src').toLowerCase() === + 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+--fcc-editable-region-- + A slice of lasagna on a plate. +--fcc-editable-region-- +
+
+ + + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6a35eacea3f48c6300b4.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6a35eacea3f48c6300b4.md new file mode 100644 index 00000000000..c56053b60c5 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6a35eacea3f48c6300b4.md @@ -0,0 +1,106 @@ +--- +id: 5dfb6a35eacea3f48c6300b4 +title: Passo 23 +challengeType: 0 +dashedName: step-23 +--- + +# --description-- + +Um elemento de legenda da figura (`figcaption`) é usado para adicionar uma legenda para descrever a imagem contida dentro do elemento `figure`. Por exemplo, `
A cute cat
` adiciona a legenda `A cute cat`. + +Após a imagem dentro do elemento `figure`, adicione um elemento `figcaption` com o texto `Cats love lasagna.` + +# --hints-- + +O elemento `img` da lasanha deve estar dentro do elemento `figure`. + +```js +assert( + document.querySelector('figure > img') && + document.querySelector('figure > img').getAttribute('src').toLowerCase() === + 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg' +); +``` + +O elemento `figcaption` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelector('figcaption')); +``` + +O elemento `figcaption` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/figcaption\>/)); +``` + +O elemento `figcaption` da lasanha deve estar dentro do elemento `figure`. + +```js +assert( + document.querySelector('figure > figcaption') && + document.querySelector('figure > figcaption') +); +``` + +O elemento `img` da lasanha deve estar dentro do elemento `figure`. + +```js +assert( + document.querySelector('figure > img') && + document.querySelector('figure > img').getAttribute('src').toLowerCase() === + 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg' +); +``` + +O elemento `figcaption` dentro do elemento `figure` deve estar abaixo do elemento `img`. Eles estão na ordem errada. + +```js +assert( + document.querySelector('figcaption').previousElementSibling.nodeName === 'IMG' +); +``` + +O texto do elemento `figcaption` deve ser `Cats love lasagna.` Você omitiu o texto ou tem um erro de digitação. + +```js +assert( + document.querySelector('figcaption').innerText.match(/Cats love lasagna.?$/i) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+--fcc-editable-region-- +
+ A slice of lasagna on a plate. +
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d0.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d0.md new file mode 100644 index 00000000000..1511d731db7 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d0.md @@ -0,0 +1,85 @@ +--- +id: 5ef9b03c81a63668521804d0 +title: Passo 24 +challengeType: 0 +dashedName: step-24 +--- + +# --description-- + +Enfatize a palavra `love` no elemento `figcaption` encapsulando-o em um elemento (`em`). + +# --hints-- + +O elemento de ênfase (`em`) deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('em')); +``` + +O elemento de ênfase (`em`) deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/em\>/)); +``` + +Você excluiu o elemento `figcaption` ou está faltando nele uma tag de abertura ou fechamento. + +```js +assert(document.querySelector('figcaption') && code.match(/<\/figcaption\>/)); +``` + +O elemento de ênfase (`em`) deve estar ao redor do texto `love`. Você omitiu o texto ou tem um erro de digitação. + +```js +assert( + document.querySelector('figcaption > em').innerText.toLowerCase() === 'love' +); +``` + +O texto da `figcaption` deve ser `Cats love lasagna`. Verifique erros de digitação e se os espaços necessários estão presentes ao redor das tags de abertura e fechamento do elemento `em`. + +```js +assert( + document + .querySelector('figcaption') + .innerText.replace(/\s+/gi, ' ') + .match(/cats love lasagna\.?/i) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +--fcc-editable-region-- +
Cats love lasagna.
+--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d1.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d1.md new file mode 100644 index 00000000000..8dbf09465a7 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d1.md @@ -0,0 +1,79 @@ +--- +id: 5ef9b03c81a63668521804d1 +title: Passo 25 +challengeType: 0 +dashedName: step-25 +--- + +# --description-- + +Depois do elemento `figure`, adicione outro elemento `h3` com o texto `Top 3 things cats hate:`. + +# --hints-- + +O elemento `h3` deve estar logo acima da tag de fechamento de fechamento do segundo elemento `section`. Certifique-se de que ele tenha uma tag de abertura e fechamento. + +```js +assert( + document.querySelectorAll('main > section')[1].lastElementChild.nodeName === + 'H3' && code.match(/<\/h3\>/g).length === 2 +); +``` + +O novo elemento `h3` deve ter o texto `Top 3 things cats hate:`. Certifique-se de incluir os dois pontos ao final do texto. + +```js +assert( + document + .querySelectorAll('main > section')[1] + .lastElementChild.innerText.toLowerCase() + .replace(/\s+/g, ' ') === 'top 3 things cats hate:' +); +``` + +Deve haver um elemento `figure` acima do novo elemento `h3`. Você pode ter excluído o elemento `figure` acidentalmente. + +```js +const secondSectionLastElemNode = document.querySelectorAll('main > section')[1] + .lastElementChild; +assert( + secondSectionLastElemNode.nodeName === 'H3' && + secondSectionLastElemNode.previousElementSibling.nodeName === 'FIGURE' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+--fcc-editable-region-- +
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d2.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d2.md new file mode 100644 index 00000000000..6a08df3c0b8 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d2.md @@ -0,0 +1,92 @@ +--- +id: 5ef9b03c81a63668521804d2 +title: Passo 26 +challengeType: 0 +dashedName: step-26 +--- + +# --description-- + +O código de uma lista ordenada (`ol`) é semelhante ao de uma lista não ordenada, mas a lista de itens em uma lista ordenada é numerada quando eles são exibidos. + +Depois do segundo elemento `section` do último elemento `h3`, adicione uma lista ordenada com estes três itens de lista: `flea treatment`, `thunder` e `other cats`. + +# --hints-- + +O elemento `ol` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('ol')); +``` + +O elemento `ol` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/ol>/)); +``` + +O elemento `ol` deve estar acima da tag de fechamento do segundo elemento `section`. Eles estão na ordem errada. + +```js +assert($('main > section')[1].lastElementChild.nodeName === 'OL'); +``` + +Os três elementos `li` devem estar dentro do elemento `ol`. + +```js +assert( + [...document.querySelectorAll('li')].filter( + (item) => item.parentNode.nodeName === 'OL' + ).length === 3 +); +``` + +Você deve ter os três elementos `li` com os textos `flea treatment`, `thunder` e `other cats`, não importando a ordem. + +```js +assert.deepStrictEqual( + [...document.querySelectorAll('li')] + .filter((item) => item.parentNode.nodeName === 'OL') + .map((item) => item.innerText.toLowerCase()) + .sort((a, b) => a.localeCompare(b)), + ['flea treatment', 'other cats', 'thunder'] +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+--fcc-editable-region-- +

Top 3 things cats hate:

+--fcc-editable-region-- +
+
+ + + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d3.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d3.md new file mode 100644 index 00000000000..7979b645c46 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d3.md @@ -0,0 +1,72 @@ +--- +id: 5ef9b03c81a63668521804d3 +title: Passo 27 +challengeType: 0 +dashedName: step-27 +--- + +# --description-- + +Depois da lista ordenada, adicione outro elemento `figure`. + +# --hints-- + +O elemento `figure` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('figure').length === 2); +``` + +O elemento `figure` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/figure>/g).length === 2); +``` + +O elemento `figure` deve estar logo acima da tag de fechamento de fechamento do segundo elemento `section`. + +```js +assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+--fcc-editable-region-- +
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d4.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d4.md new file mode 100644 index 00000000000..a10b03232f0 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d4.md @@ -0,0 +1,96 @@ +--- +id: 5ef9b03c81a63668521804d4 +title: Passo 31 +challengeType: 0 +dashedName: step-31 +--- + +# --description-- + +O elemento `strong` é usado para indicar que algum texto é de grande importância ou urgência. + +Na `figcaption` que você acabou de adicionar, indique que `hate` é de grande importância envolvendo a palavra em um elemento `strong`. + +# --hints-- + +O elemento `strong` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('strong')); +``` + +O elemento `strong` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/strong\>/)); +``` + +O elemento `strong` deve cercar a palavra `hate` no texto `Cats hate other cats.` Você omitiu o texto ou tem um erro de digitação. + +```js +assert( + document + .querySelectorAll('figcaption')[1] + .querySelector('strong') + .innerText.toLowerCase() === 'hate' +); +``` + +O texto da `figcaption` deve ser `Cats hate other cats.` Verifique erros de digitação e se os espaços necessários estão presentes ao redor das tags de abertura e fechamento do elemento `strong`. + +```js +const secondFigCaption = document.querySelectorAll('figcaption')[1]; +assert( + secondFigCaption && + secondFigCaption.innerText + .replace(/\s+/gi, ' ') + .trim() + .match(/cats hate other cats\.?/i) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +--fcc-editable-region-- +
Cats hate other cats.
+--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d5.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d5.md new file mode 100644 index 00000000000..1ee935cf340 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d5.md @@ -0,0 +1,103 @@ +--- +id: 5ef9b03c81a63668521804d5 +title: Passo 33 +challengeType: 0 +dashedName: step-33 +--- + +# --description-- + +Dentro do terceiro elemento `section`, adicione um novo elemento `h2` com o texto `Cat Form`. + +# --hints-- + +Não foi possível encontrar o terceiro elemento `section`. Você pode ter excluído o elemento, sua tag de abertura ou de fechamento acidentalmente. + +```js +assert( + document.querySelectorAll('section').length === 3 && + code.match(/<\/section>/g).length === 3 +); +``` + +O elemento `h2` deve ter uma tag de abertura e uma de fechamento. Pode ser que você não tenha inserido uma das tags obrigatórias ou ambas. + +```js +assert( + document.querySelectorAll('h2').length >= 3 && + code.match(/<\/h2>/g).length >= 3 +); +``` + +Você deve adicionar apenas um elemento `h2`. Remova as tags adicionais. + +```js +assert(document.querySelectorAll('h2').length === 3); +``` + +O novo elemento `h2` deve estar logo acima da tag de fechamento do terceiro elemento `section`. + +```js +const thirdSection = document.querySelectorAll('section')[2]; +assert(thirdSection.lastElementChild.nodeName === 'H2'); +``` + +O texto do elemento `h2` deve ser `Cat Form`. + +```js +const thirdSection = document.querySelectorAll('section')[2]; +assert( + thirdSection + .querySelector('h2') + .innerText.toLowerCase() + .replace(/\s+/g, ' ') === 'cat form' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+--fcc-editable-region-- +
+
+--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md new file mode 100644 index 00000000000..6d3647b72c3 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md @@ -0,0 +1,88 @@ +--- +id: 5ef9b03c81a63668521804d6 +title: Passo 34 +challengeType: 0 +dashedName: step-34 +--- + +# --description-- + +Agora, adicione um formulário para a web para coletar informações de usuários. + +Depois do cabeçalho `Cat Form`, adicione um elemento `form`. + +# --hints-- + +O elemento `form` deve ter uma tag de abertura e uma de fechamento. Pode ser que você não tenha inserido uma delas, as duas, ou que elas estejam na ordem errada. + +```js +assert(document.querySelector('form') && code.match(/<\/form>/g)); +``` + +As tags do elemento `form` não estão na ordem correta. + +```js +const noSpaces = code.replace(/\s/g, ''); +assert(noSpaces.indexOf('
') < noSpaces.indexOf('
')); +``` + +O elemento `form` dentro do último elemento `section` deve estar abaixo do elemento `h2`. O elemento `h2` e o elemento `form` estão na ordem errada. + +```js +assert(document.querySelector('form').previousElementSibling.nodeName === 'H2'); +``` + +O elemento `form` não deve ter conteúdo. Remova os elementos HTML ou o texto entre as tags do elemento `form`. + +```js +assert($('form')[0].innerHTML.trim().length === 0); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+--fcc-editable-region-- +

Cat Form

+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d7.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d7.md new file mode 100644 index 00000000000..26ce2df2310 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d7.md @@ -0,0 +1,116 @@ +--- +id: 5ef9b03c81a63668521804d7 +title: Passo 35 +challengeType: 0 +dashedName: step-35 +--- + +# --description-- + +O atributo `action` indica para onde os dados do formulário devem ser enviados. Por exemplo, `
` informa ao navegador que os dados do formulário devem ser enviados para o caminho `/submit-url`. + +Adicione um atributo `action` com o valor `https://freecatphotoapp.com/submit-cat-photo` ao elemento `form`. + +# --hints-- + +O elemento `form` deve ter uma tag de abertura e uma de fechamento na ordem correta. Pode ser que você não tenha inserido uma delas, as duas, ou que elas estejam na ordem errada. + +```js +const noSpaces = code.replace(/\s/g, ''); +assert( + document.querySelector('form') && + code.match(/<\/form>/g) && + noSpaces.indexOf('') +); +``` + +O elemento `form` dentro do último elemento `section` deve estar abaixo do elemento `h2`. O elemento `h2` e o elemento `form` estão na ordem errada. + +```js +assert(document.querySelector('form').previousElementSibling.nodeName === 'H2'); +``` + +O elemento `form` não deve ter conteúdo. Remova os elementos HTML ou o texto entre as tags do elemento `form`. + +```js +assert($('form')[0].innerHTML.trim().length === 0); +``` + +O elemento `form` não tem um atributo `action`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +const form = document.querySelector('form'); +assert(form.hasAttribute('action')); +``` + +O elemento `form` deve ter o atributo `action` com o valor `https://freecatphotoapp.com/submit-cat-photo`. + +```js +const form = document.querySelector('form'); +assert( + form + .getAttribute('action') + .match(/^https:\/\/freecatphotoapp\.com\/submit-cat-photo$/) +); +``` + +Embora você tenha definido o valor do atributo `action` com o URL correto, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert( + !/\ + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+--fcc-editable-region-- +
+
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d8.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d8.md new file mode 100644 index 00000000000..7571c78c195 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d8.md @@ -0,0 +1,109 @@ +--- +id: 5ef9b03c81a63668521804d8 +title: Passo 36 +challengeType: 0 +dashedName: step-36 +--- + +# --description-- + +O elemento `input` permite a você várias maneiras de coletar dados a partir de um formulário da web. Assim como os elementos `img`, os elementos `input` são de fechamento automático e não precisam de tags de fechamento. + +Adicione um elemento `input` dentro do elemento `form`. + +# --hints-- + +O elemento `form` deve ter uma tag de abertura e uma de fechamento na ordem correta. Pode ser que você não tenha inserido uma delas, as duas, ou que elas estejam na ordem errada. + +```js +const noSpaces = code.replace(/\s/g, ''); +assert( + document.querySelector('form') && + code.match(/<\/form>/g) && + noSpaces.indexOf('') +); +``` + +A tag de abertura do elemento `form` deve ter apenas o atributo `action`. Remova qualquer outra coisa que você possa ter digitado nela. + +```js +assert([...document.querySelector('form').attributes].length < 2); +``` + +Você deve criar um elemento input. Confira a sintaxe. + +```js +assert(document.querySelector('input')); +``` + +O elemento `input` deve ter uma tag de abertura, mas não uma de fechamento. + +```js +assert(document.querySelector('input') && !code.match(/<\/input\>/g)); +``` + +O elemento `input` deve estar dentro do elemento `form`. + +```js +assert(document.querySelector('form > input')); +``` + +O elemento `form` deve conter apenas o elemento `input`. Remova os elementos HTML ou o texto entre as tags do elemento `form`. + +```js +assert( + $('form')[0].children.length === 1 && + $('form')[0].innerText.trim().length === 0 +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+--fcc-editable-region-- +
+
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d9.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d9.md new file mode 100644 index 00000000000..7290ab31e99 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d9.md @@ -0,0 +1,104 @@ +--- +id: 5ef9b03c81a63668521804d9 +title: Passo 39 +challengeType: 0 +dashedName: step-39 +--- + +# --description-- + +O texto de placeholder é usado para dar às pessoas uma dica sobre o tipo de informação que deve ser inserido em uma entrada (input). Por exemplo, ``. + +Adicione o placeholder `cat photo URL` ao elemento `input`. + +# --hints-- + +Você excluiu o elemento `input` ou ele tem uma sintaxe inválida. Os valores de todos os atributos devem estar cercados com aspas. + +```js +assert($('input').length); +``` + +O elemento `form` deve conter apenas o elemento `input`. Remova os elementos HTML ou o texto adicionais do elemento `form`. + +```js +assert( + $('form')[0].children.length === 1 && + $('form')[0].innerText.trim().length === 0 +); +``` + +O elemento `input` não tem um atributo `placeholder`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('input')[0].hasAttribute('placeholder')); +``` + +O elemento `input` deve ter um atributo `placeholder` com o valor `cat photo URL`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert( + $('input')[0] + .getAttribute('placeholder') + .replace(/\s+/g, ' ') + .match(/^cat photo URL$/i) +); +``` + +Embora você tenha definido o atributo `placeholder` do elemento `input` com o valor `cat photo URL`, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\<\s*input\s+placeholder\s*=\s*cat\s+photo\s+url/i.test(code)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804da.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804da.md new file mode 100644 index 00000000000..b59a70851b6 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804da.md @@ -0,0 +1,93 @@ +--- +id: 5ef9b03c81a63668521804da +title: Passo 41 +challengeType: 0 +dashedName: step-41 +--- + +# --description-- + +Use o elemento `button` para criar um botão clicável. Por exemplo, `` cria um botão com o texto `Click Here`. + +Adicione um elemento `button` com o texto `Submit` abaixo do elemento `input`. O comportamento padrão de clicar em um botão de formulário sem qualquer atributo envia o formulário para o local especificado no atributo `action`. + +# --hints-- + +O elemento `button` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('button')); +``` + +O elemento `button` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/button\>/)); +``` + +O texto do elemento `button` deve ser `Submit`. Você omitiu o texto ou tem um erro de digitação. + +```js +assert(document.querySelector('button').innerText.toLowerCase() === 'submit'); +``` + +O elemento `button` deve estar abaixo do elemento `input`. Eles estão na ordem errada. + +```js +const collection = [...document.querySelectorAll('input, button')].map( + (node) => node.nodeName +); +assert(collection.indexOf('INPUT') < collection.indexOf('BUTTON')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804db.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804db.md new file mode 100644 index 00000000000..8c8daf32f3f --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804db.md @@ -0,0 +1,91 @@ +--- +id: 5ef9b03c81a63668521804db +title: Passo 40 +challengeType: 0 +dashedName: step-40 +--- + +# --description-- + +Para evitar que um usuário envie o formulário quando as informações necessárias estiverem faltando, você precisa adicionar o atributo `required` a um elemento `input`. Não há a necessidade de definir um valor para o atributo `required`. Em vez disso, apenas adicione a palavra `required` (obrigatório) ao elemento `input`, certificando-se de que haja um espaço entre esse atributo e os outros. + +# --hints-- + +Você excluiu o elemento `input` ou ele tem uma sintaxe inválida. Os valores de todos os atributos devem estar cercados com aspas. + +```js +assert($('input').length); +``` + +O elemento `form` deve conter apenas o elemento `input`. Remova os elementos HTML ou o texto adicionais do elemento `form`. + +```js +assert( + $('form')[0].children.length === 1 && + $('form')[0].innerText.trim().length === 0 +); +``` + +O elemento `input` deve ter o atributo `required`. Lembre-se: você deve apenas adicionar a palavra `required` dentro da tag do elemento `input`. + +```js +assert($('input')[0].hasAttribute('required')); +``` + +Não deve ser dado algum valor para o atributo `required`. + +```js +assert($('input')[0].getAttribute('required') === ''); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804dc.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804dc.md new file mode 100644 index 00000000000..6e26edaac5c --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804dc.md @@ -0,0 +1,135 @@ +--- +id: 5ef9b03c81a63668521804dc +title: Passo 43 +challengeType: 0 +dashedName: step-43 +--- + +# --description-- + +Você pode usar botões de opção para perguntas onde você queira que o usuário dê apenas uma resposta entre várias opções. + +Aqui está um exemplo de um botão de opção com a opção `cat`: ` cat`. Lembre-se de que os elementos `input` são de fechamento automático. + +Antes da entrada de texto, adicione um botão de opção com a opção `Indoor`. + +# --hints-- + +Você deve criar um elemento input para o botão de opção. Confira a sintaxe. + +```js +assert($('form > input').length >= 2); +``` + +O elemento `input` deve ter uma tag de abertura, mas não uma de fechamento. + +```js +assert($('form > input') && !code.match(/<\/input\>/g)); +``` + +Você deve adicionar apenas um elemento input para o botão de opção. Remova os elementos adicionais. + +```js +assert($('form > input').length === 2); +``` + +O novo elemento `input` deve estar acima do elemento `input` existente com o atributo `type` definido como `text`. Eles estão na ordem errada. + +```js +const existingInputElem = document.querySelector('form > input[type="text"]'); +assert( + existingInputElem && + existingInputElem.previousElementSibling.nodeName === 'INPUT' +); +``` + +O novo elemento `input` não tem um atributo `type`. Verifique se há um espaço depois do nome da tag de abertura. + +```js +assert($('input')[0].hasAttribute('type')); +``` + +O novo elemento `input` deve ter o atributo `type` com o valor `radio`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert( + $('input')[0] + .getAttribute('type') + .match(/^radio$/i) +); +``` + +Embora você tenha definido o atributo `type` do elemento `input` com o valor `radio`, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\<\s*input\s+type\s*=\s*radio/i.test(code)); +``` + +O texto do botão `radio` deve ser `Indoor` e estar localizado depois do botão em vez de antes dele. + +```js +const radioInputElem = $('input')[0]; +assert(!radioInputElem.previousSibling.nodeValue.match(/Indoor/i)); +``` + +O texto `Indoor` deve estar localizado diretamente à direita do seu botão `radio`. Certifique-se de que haja um espaço entre o elemento e o texto. Você omitiu o texto ou tem um erro de digitação. + +```js +const radioInputElem = $('input')[0]; +assert( + radioInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Indoor/i) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804dd.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804dd.md new file mode 100644 index 00000000000..f665c8d0036 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804dd.md @@ -0,0 +1,104 @@ +--- +id: 5ef9b03c81a63668521804dd +title: Passo 44 +challengeType: 0 +dashedName: step-44 +--- + +# --description-- + +Os elementos `label` são usados para ajudar a associar o texto de um elemento `input` com o próprio elemento (especialmente para tecnologias assistivas como leitores de tela). Por exemplo, `` torna possível que clicar na palavra `cat` também selecione o botão de opção correspondente. + +Coloque o botão `radio` dentro de um elemento `label`. + +# --hints-- + +Confira se o botão de opção ainda está presente. + +```js +assert($('input[type="radio"]')[0]); +``` + +O texto `Indoor` deve estar localizado diretamente à direita do botão `radio`. Certifique-se de que haja um espaço entre o elemento e o texto. Você omitiu o texto ou tem um erro de digitação. + +```js +const radioInputElem = $('input')[0]; +assert( + radioInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Indoor/i) +); +``` + +O elemento `label` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('label')); +``` + +O elemento `label` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/label\>/)); +``` + +O botão de opção e o texto devem estar todos localizados entre as tags de abertura e fechamento do elemento `label`. + +```js +const labelChildNodes = [...$('form > label')[0].childNodes]; +assert( + labelChildNodes.filter((childNode) => childNode.nodeName === 'INPUT').length +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + Indoor +--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804de.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804de.md new file mode 100644 index 00000000000..40a1cef82c8 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804de.md @@ -0,0 +1,98 @@ +--- +id: 5ef9b03c81a63668521804de +title: Passo 47 +challengeType: 0 +dashedName: step-47 +--- + +# --description-- + +Observe que os dois botões de opção podem ser selecionados ao mesmo tempo. Para fazer com que selecionar um botão de opção automaticamente desmarque a seleção do outro, os dois botões devem ter um atributo de `name` com o mesmo valor. + +Adicione o atributo `name` com o valor `indoor-outdoor` para os dois botões de opção. + +# --hints-- + +Os dois botões de opção ainda devem estar localizados entre as tags de abertura e de fechamento do elemento `label`. + +```js +const labelChildNodes = [...document.querySelectorAll('form > label')].map( + (node) => node.childNodes +); +assert( + labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT') + .length === 2 +); +``` + +Os dois botões de opção devem ter um atributo `name`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +const radioButtons = [...document.querySelectorAll('input[type="radio"]')]; +assert(radioButtons.every((btn) => btn.hasAttribute('name'))); +``` + +Os botões de opção devem ter o atributo `name` com o valor `indoor-outdoor`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +const radioButtons = [...$('input[type="radio"]')]; +assert( + radioButtons.every((btn) => + btn.getAttribute('name').match(/^indoor-outdoor$/) + ) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + + +--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804df.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804df.md new file mode 100644 index 00000000000..8a78549a5df --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804df.md @@ -0,0 +1,89 @@ +--- +id: 5ef9b03c81a63668521804df +title: Passo 45 +challengeType: 0 +dashedName: step-45 +--- + +# --description-- + +O atributo `id` é usado para identificar elementos HTML específicos. O valor de cada atributo `id` deve ser único em comparação aos outros valores de `id` para a página inteira. + +Adicione o atributo `id` com o valor `indoor` para o botão de opção. Quando os elementos têm vários atributos, a ordem desses atributos não importa. + +# --hints-- + +O botão de opção deve estar localizado entre as tags de abertura e fechamento do elemento `label`. + +```js +const labelChildNodes = [...$('form > label')[0].childNodes]; +assert( + labelChildNodes.filter((childNode) => childNode.nodeName === 'INPUT').length +); +``` + +O botão de opção deve ter um atributo `id`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('input')[0].hasAttribute('id')); +``` + +O botão de opção deve ter o atributo `id` com o valor `indoor`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert($('input')[0].id.match(/^indoor$/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e1.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e1.md new file mode 100644 index 00000000000..e1cd9da5949 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e1.md @@ -0,0 +1,100 @@ +--- +id: 5ef9b03c81a63668521804e1 +title: Passo 49 +challengeType: 0 +dashedName: step-49 +--- + +# --description-- + +O elemento `fieldset` é usado para agrupar entradas (inputs) e rótulos (labels) relacionados em um formulário da web. Os elementos `fieldset` são elementos de nível de bloco, o que significa que eles aparecem em uma nova linha. + +Coloque os botões de opção `Indoor` e `Outdoor` dentro de um elemento `fieldset` e não se esqueça de indentar os botões de opção. + +# --hints-- + +Os dois botões de opção ainda devem estar localizados entre as tags de abertura e de fechamento do elemento `label`. + +```js +const labelChildNodes = [...$('label')].map((node) => [...node.childNodes]); +assert( + labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT') + .length === 2 +); +``` + +O elemento `fieldset` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelector('fieldset')); +``` + +O elemento `fieldset` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/fieldset\>/)); +``` + +Os botões de opção e seus rótulos (labels) associados devem estar localizados entre as tags de abertura e de fechamento do elemento `fieldset`. + +```js +const radioButtons = [...$('input[type="radio"]')]; +assert( + radioButtons.every((btn) => btn.parentNode.parentNode.nodeName === 'FIELDSET') +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + + +--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e2.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e2.md new file mode 100644 index 00000000000..d4d783020bd --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e2.md @@ -0,0 +1,128 @@ +--- +id: 5ef9b03c81a63668521804e2 +title: Passo 53 +challengeType: 0 +dashedName: step-53 +--- + +# --description-- + +Os formulários normalmente usam caixas de seleção para perguntas que tenham mais de uma resposta. Por exemplo, aqui temos uma caixa de seleção com a opção `tacos`: ` tacos`. + +No elemento `legend` que você acaba de adicionar, adicione um elemento `input` com o atributo `type` definido como `checkbox` e dê a ele a opção `Loving`. + +# --hints-- + +O elemento `input` de sua caixa de seleção deve ter uma tag de abertura, mas não uma de fechamento. + +```js +assert($('fieldset > input') && !code.match(/<\/input\>/g)); +``` + +Você deve adicionar apenas um elemento input para a caixa de seleção. Remova os elementos adicionais. + +```js +assert($('fieldset > input').length === 1); +``` + +O novo elemento `input` deve estar abaixo do elemento `legend` com o texto `What's your cat's personality?`. Eles estão na ordem errada. + +```js +const existingLegendElem = $('fieldset > legend')[1]; +assert( + existingLegendElem && + existingLegendElem.nextElementSibling.nodeName === 'INPUT' +); +``` + +O novo elemento `input` não tem um atributo `type`. Verifique se há um espaço depois do nome da tag de abertura. + +```js +assert($('fieldset > input')[0].hasAttribute('type')); +``` + +O novo elemento `input` deve ter o atributo `type` com o valor `checkbox`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert( + $('fieldset > input')[0] + .getAttribute('type') + .match(/^checkbox$/i) +); +``` + +Embora você tenha definido o atributo `type` do elemento `input` com o valor `checkbox`, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\<\s*input\s+type\s*=\s*checkbox/i.test(code)); +``` + +O texto `Loving` deve estar localizado diretamente à direita da caixa de seleção. Certifique-se de que haja um espaço entre o elemento e o texto. Você omitiu o texto ou tem um erro de digitação. + +```js +const checkboxInputElem = $('input[type="checkbox"]')[0]; +assert( + checkboxInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Loving/i) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+--fcc-editable-region-- + What's your cat's personality? +--fcc-editable-region-- +
+ + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e3.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e3.md new file mode 100644 index 00000000000..5fe6e5dfe95 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e3.md @@ -0,0 +1,122 @@ +--- +id: 5ef9b03c81a63668521804e3 +title: Passo 57 +challengeType: 0 +dashedName: step-57 +--- + +# --description-- + +Adicione outra caixa de seleção depois daquela que você acaba de adicionar. O valor do atributo `id` deve ser `lazy` e o valor do atributo `name` deve ser o mesmo que o da última caixa de seleção. + +Adicione também um elemento `label` à direita da nova caixa de seleção com o texto `Lazy`. Certifique-se de associar o elemento `label` com a nova caixa de seleção usando o atributo `for`. + +# --hints-- + +Você precisa adicionar uma nova caixa de seleção. + +```js +assert($('input[type="checkbox"]').length === 2); +``` + +A nova caixa de seleção deve ter um atributo `id` com o valor `lazy` e um atributo `name` com o valor `personality`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +const checkboxes = [...$('input[type="checkbox"]')]; +assert( + checkboxes.some( + (checkbox) => + checkbox.id === 'lazy' && checkbox.getAttribute('name') === 'personality' + ) +); +``` + +A nova caixa de seleção deve vir depois da primeira. Elas estão na ordem errada. + +```js +const checkboxes = [...$('input[type="checkbox"]')].map( + (checkbox) => checkbox.id +); +assert(checkboxes.indexOf('loving') < checkboxes.indexOf('lazy')); +``` + +No lado direito da nova caixa de seleção, deve haver um elemento `label` com o texto `Lazy`. + +```js +const nextElementSibling = $('input[type="checkbox"]')[1].nextElementSibling; +assert( + nextElementSibling.nodeName === 'LABEL' && + nextElementSibling.innerText.replace(/\s+/g, '').match(/^Lazy$/i) +); +``` + +O novo `label` deve ter um atributo `for` com o mesmo valor que o atributo `id` da nova caixa de seleção. Você omitiu o valor ou tem um erro de digitação. + +```js +assert( + $('input[type="checkbox"]')[1].nextElementSibling.getAttribute('for') === + 'lazy' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? +--fcc-editable-region-- + +--fcc-editable-region-- +
+ + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e5.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e5.md new file mode 100644 index 00000000000..6db1fda6c2f --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e5.md @@ -0,0 +1,117 @@ +--- +id: 5ef9b03c81a63668521804e5 +title: Passo 60 +challengeType: 0 +dashedName: step-60 +--- + +# --description-- + +Para que uma caixa de seleção ou botão de opção esteja selecionado por padrão, você precisa adicionar o atributo `checked` ao elemento. Não há a necessidade de definir um valor para o atributo `checked`. Em vez disso, apenas adicione a palavra `checked` (selecionado) ao elemento `input`, certificando-se de que haja um espaço entre esse atributo e os outros. + +Faça com que o primeiro botão de opção e a primeira caixa de seleção estejam selecionados por padrão. + +# --hints-- + +Certifique-se de que ainda existam dois botões de opção e três caixas de seleção dentro de seus respectivos elementos `fieldset`. + +```js +assert( + $('input[type="radio"]').length === 2 && + $('fieldset > input[type="checkbox"]').length === 3 +); +``` + +O primeiro botão de opção não tem o atributo `checked`. + +```js +assert($('input[type="radio"]')[0].hasAttribute('checked')); +``` + +O segundo botão de opção não deve ter o atributo `checked`. + +```js +assert(!$('input[type="radio"]')[1].hasAttribute('checked')); +``` + +A primeira caixa de seleção não tem o atributo `checked`. + +```js +assert($('input[type="checkbox"]')[0].hasAttribute('checked')); +``` + +A segunda caixa de seleção não deve ter o atributo `checked`. + +```js +assert(!$('input[type="checkbox"]')[1].hasAttribute('checked')); +``` + +A terceira caixa de seleção não deve ter o atributo `checked`. + +```js +assert(!$('input[type="checkbox"]')[2].hasAttribute('checked')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- +
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e7.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e7.md new file mode 100644 index 00000000000..50f6e63a650 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e7.md @@ -0,0 +1,102 @@ +--- +id: 5ef9b03c81a63668521804e7 +title: Passo 61 +challengeType: 0 +dashedName: step-61 +--- + +# --description-- + +Agora você vai adicionar uma seção de rodapé à página. + +Depois do elemento `main`, adicione um elemento `footer`. + +# --hints-- + +Você excluiu o elemento `main` ou está faltando nele uma tag de abertura ou de fechamento. + +```js +assert(document.querySelector('main') && code.match(/<\/main>/)); +``` + +O elemento `footer` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelector('footer')); +``` + +O elemento `footer` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/footer\>/)); +``` + +O elemento `footer` deve estar abaixo do elemento `main`. Você o colocou em um lugar diferente. + +```js +assert(document.querySelector('main').nextElementSibling.nodeName === 'FOOTER'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+ + +
+
+--fcc-editable-region-- +
+ + +--fcc-editable-region-- +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e9.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e9.md new file mode 100644 index 00000000000..eacb8db2138 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e9.md @@ -0,0 +1,118 @@ +--- +id: 5ef9b03c81a63668521804e9 +title: Passo 63 +challengeType: 0 +dashedName: step-63 +--- + +# --description-- + +Torne o texto `freeCodeCamp.org` um link, incluindo-o em um elemento de âncora (`a`). O atributo `href` deve estar definido como `https://www.freecodecamp.org`. + +# --hints-- + +O elemento de âncora (`a`) deve estar dentro do elemento `footer`. Certifique-se de adicionar uma tag de abertura e uma tag de fechamento para o elemento de âncora (`a`). + +```js +assert($('footer > p > a').length); +``` + +O elemento de âncora (`a`) deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +const aElemClosingTags = code.match(/<\/a\>/g); +assert(aElemClosingTags && aElemClosingTags.length === 3); +``` + +O elemento de âncora (`a`) deve ter o atributo `href` com o valor `https://www.freecodecamp.org`. Você pode ter omitido o atributo ou ter um erro de digitação. + +```js +const nestedAnchor = $('footer > p > a')[0]; +assert(nestedAnchor.getAttribute('href') === 'https://www.freecodecamp.org'); +``` + +O texto do link deve ser `freeCodeCamp.org`. Você omitiu o texto ou tem um erro de digitação. + +```js +const nestedAnchor = $('footer > p > a')[0]; +assert( + nestedAnchor.innerText.toLowerCase().replace(/\s+/g, ' ') === + 'freecodecamp.org' +); +``` + +Após aninhar o elemento âncora (`a`), o único conteúdo do elemento `p` visível no navegador deve ser `No Copyright - freeCodeCamp.org`. Verifique mais uma vez o texto, o espaçamento e a pontuação do elemento `p` e do elemento de âncora aninhado. + +```js +const pText = $('footer > p')[0].innerText.toLowerCase().replace(/\s+/g, ' '); +assert(pText.match(/^no copyright - freecodecamp.org$/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+ + +
+
+
+
+

+--fcc-editable-region-- + No Copyright - freeCodeCamp.org +--fcc-editable-region-- +

+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ea.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ea.md new file mode 100644 index 00000000000..0feda03b776 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ea.md @@ -0,0 +1,108 @@ +--- +id: 5ef9b03c81a63668521804ea +title: Passo 64 +challengeType: 0 +dashedName: step-64 +--- + +# --description-- + +Observe que tudo o que você adicionou à página até agora está dentro do elemento `body`. Todos os elementos de conteúdo da página que devem ser renderizados na página ficam dentro do elemento `body`. No entanto, outras informações importantes vão dentro do elemento `head`. + +Adicione um elemento `head` logo acima do elemento `body`. + +# --hints-- + +Você excluiu o elemento `body` ou está faltando nele uma tag de abertura ou de fechamento. + +```js +assert(document.querySelector('body') && code.match(/<\/body>/)); +``` + +O elemento `head` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(code.match(/\/)); +``` + +O elemento `head` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/\<\/head\>/)); +``` + +O elemento `head` deve estar acima do elemento `body`. Você o colocou em um lugar diferente. + +```js +const noSpaces = code.replace(/\s/g, ''); +assert(noSpaces.match(/\<\/head\>\/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + +--fcc-editable-region-- + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+ + +
+
+
+ + +--fcc-editable-region-- + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804eb.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804eb.md new file mode 100644 index 00000000000..fc2644d7125 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804eb.md @@ -0,0 +1,110 @@ +--- +id: 5ef9b03c81a63668521804eb +title: Passo 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +O elemento `title` determina o que os navegadores mostrarão na barra de título ou na aba da página. + +Adicione um elemento `title` dentro do elemento `head`. O texto deve ser `CatPhotoApp`. + +# --hints-- + +Você excluiu o elemento `head` ou está faltando nele uma tag de abertura ou de fechamento. + +```js +assert(code.match(/\/) && code.match(/\<\/head\>/)); +``` + +O elemento `title` deve estar dentro do elemento `head`. Certifique-se de adicionar uma tag de abertura e uma tag de fechamento para o elemento `title`. + +```js +const noSpaces = code.replace(/\s/g, ''); +assert(noSpaces.match(/\\.*\<\/title\>\<\/head\>/)); +``` + +O elemento `title` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/\<\/title\>/)); +``` + +O elemento `title` deve conter o texto `CatPhotoApp`. Você omitiu o texto ou tem um erro de digitação. + +```js +assert(document.title && document.title.toLowerCase() === 'catphotoapp'); +``` + +# --seed-- + +## --seed-contents-- + +```html + +--fcc-editable-region-- + + +--fcc-editable-region-- + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+ + +
+
+
+ + + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ec.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ec.md new file mode 100644 index 00000000000..9ac41f3b27b --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ec.md @@ -0,0 +1,105 @@ +--- +id: 5ef9b03c81a63668521804ec +title: Passo 66 +challengeType: 0 +dashedName: step-66 +--- + +# --description-- + +Observe que todo o conteúdo da página está aninhado em um elemento `html`. Todos os outros elementos devem ser descendentes (estar dentro) deste elemento `html`. + +Adicione o atributo `lang` com o valor `en` à tag de abertura de `html` para especificar que o idioma da página é o inglês. + +# --hints-- + +Você excluiu o elemento `html` ou está faltando nele uma tag de abertura ou de fechamento. + +```js +assert(code.match(/\/) && code.match(/\<\/html\>/)); +``` + +O elemento `html` deve ter o atributo `lang` com o valor `en`. Você pode ter omitido o atributo ou ter um erro de digitação. + +```js +const extraSpacesRemoved = code.replace(/\s+/g, ' '); +assert(extraSpacesRemoved.match(/\/)); +``` + +Embora você tenha definido o atributo `lang` do elemento `html` com o valor `en`, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\<\s*html\s+lang\s*=en/i.test(code)); +``` + +# --seed-- + +## --seed-contents-- + +```html +--fcc-editable-region-- + +--fcc-editable-region-- + + CatPhotoApp + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+ + +
+
+
+ + + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ee.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ee.md new file mode 100644 index 00000000000..174864310ce --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804ee.md @@ -0,0 +1,166 @@ +--- +id: 5ef9b03c81a63668521804ee +title: Passo 67 +challengeType: 0 +dashedName: step-67 +--- + +# --description-- + +Todas as páginas devem começar com ``. Essa string especial é conhecida como uma declaração e garante que o navegador tentará atender às especificações gerais do setor. + +Para concluir este projeto, adicione a declaração como a primeira linha do código. + +# --hints-- + +O código deve começar com a declaração ``. Você pode ter omitido a declaração, ter um erro de digitação ou a declaração pode não ser a primeira linha do código. + +```js +assert(code.match(/\<\s*!DOCTYPE\s+html\s*\>/)); +``` + +`` deve estar localizada na parte superior do documento. + +```js +const noSpaces = code.replace(/\s/g, ''); +assert(noSpaces.match(/^\<\!DOCTYPEhtml\>\ + + CatPhotoApp + +--fcc-editable-region-- + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+ + +
+
+
+ + + +``` + +# --solutions-- + +```html + + + + CatPhotoApp + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+ + +
+
+
+ + + +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efada803cbd2bbdab94e332.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efada803cbd2bbdab94e332.md new file mode 100644 index 00000000000..52e93120cf0 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efada803cbd2bbdab94e332.md @@ -0,0 +1,100 @@ +--- +id: 5efada803cbd2bbdab94e332 +title: Passo 28 +challengeType: 0 +dashedName: step-28 +--- + +# --description-- + +Dentro do elemento `figure` que você acabou de adicionar, coloque um elemento `img` com um atributo `src` definido como `https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg`. + +# --hints-- + +O segundo elemento `figure` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('figure').length === 2); +``` + +O segundo elemento `figure` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/figure>/g).length === 2); +``` + +O segundo elemento `figure` deve estar logo acima da tag de fechamento de fechamento do segundo elemento `section`. Eles estão na ordem errada. + +```js +assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE'); +``` + +Você deve adicionar um terceiro elemento `img` dentro do elemento `figure`. + +```js +const catsImg = document.querySelectorAll('figure > img')[1]; +assert( + catsImg && + catsImg.getAttribute('src').toLowerCase() === 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg' +); +``` + +A terceira imagem deve ter um atributo `src` com o valor de `https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg`. + +```js +const catsImg = document.querySelectorAll('figure > img')[1]; +assert( + catsImg && + catsImg.getAttribute('src').toLowerCase() === 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg' +); +``` + +Embora você tenha definido o valor de `src` com o URL correto, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\ + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+--fcc-editable-region-- +
+
+--fcc-editable-region-- +
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae0543cbd2bbdab94e333.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae0543cbd2bbdab94e333.md new file mode 100644 index 00000000000..c73ceab277d --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae0543cbd2bbdab94e333.md @@ -0,0 +1,97 @@ +--- +id: 5efae0543cbd2bbdab94e333 +title: Passo 29 +challengeType: 0 +dashedName: step-29 +--- + +# --description-- + +Para melhorar a acessibilidade da imagem que você acabou de inserir, adicione um atributo `alt` com o texto `Five cats looking around a field.` + +# --hints-- + +O elemento `figure` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('figure').length === 2); +``` + +O elemento `ol` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/figure>/g).length === 2); +``` + +O elemento `figure` deve estar logo acima da tag de fechamento de fechamento do último elemento `section`. + +```js +assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE'); +``` + +O elemento `img` dos gatos deve estar dentro do elemento `figure`. + +```js +const catsImg = document.querySelectorAll('figure > img')[1]; +assert( + catsImg && + catsImg.getAttribute('src').toLowerCase() === 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg' +); +``` + +O elemento `img` dos gatos deve ter um atributo `alt` com o valor `Five cats looking around a field.` + +```js +const catsImg = document.querySelectorAll('figure > img')[1]; +assert( + catsImg + .getAttribute('alt') + .replace(/\s+/g, ' ') + .match(/^Five cats looking around a field\.?$/i) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+--fcc-editable-region-- + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae16e3cbd2bbdab94e334.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae16e3cbd2bbdab94e334.md new file mode 100644 index 00000000000..b7ca485a75c --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae16e3cbd2bbdab94e334.md @@ -0,0 +1,123 @@ +--- +id: 5efae16e3cbd2bbdab94e334 +title: Passo 30 +challengeType: 0 +dashedName: step-30 +--- + +# --description-- + +Depois do último elemento `img`, adicione um elemento `figcaption` com o texto `Cats hate other cats.` + +# --hints-- + +O elemento `figcaption` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelectorAll('figcaption').length === 2); +``` + +O elemento `figcaption` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/figcaption\>/g).length === 2); +``` + +O elemento `figure` deve estar logo acima da tag de fechamento de fechamento do segundo elemento `section`. + +```js +assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE'); +``` + +O último elemento `img` deve estar dentro do elemento `figure`. + +```js +const catsImg = document.querySelectorAll('figure > img')[1]; +assert( + catsImg && + catsImg.getAttribute('src').toLowerCase() === 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg' +); +``` + +O elemento `figure` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelectorAll('figure').length === 2); +``` + +O elemento `figure` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/figure\>/g).length === 2); +``` + +O elemento `figcaption` da lasanha deve estar dentro do elemento `figure`. + +```js +assert(document.querySelectorAll('figure > figcaption').length === 2); +``` + +O elemento `figcaption` dentro do elemento `figure` deve estar abaixo do elemento `img`. O elemento `img` e o elemento `figcaption` estão na ordem errada. + +```js +assert( + document.querySelectorAll('figcaption')[1].previousElementSibling.nodeName === + 'IMG' +); +``` + +O elemento `figcaption` deve ter o texto `Cats hate other cats.` Você omitiu uma palavra ou tem um erro de digitação. + +```js +assert( + document + .querySelectorAll('figcaption')[1] + .innerText.toLowerCase() + .match(/Cats hate other cats\.?$/i) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+--fcc-editable-region-- + Five cats looking around a field. +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efb23e70dc218d6c85f89b1.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efb23e70dc218d6c85f89b1.md new file mode 100644 index 00000000000..795030ab8e1 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efb23e70dc218d6c85f89b1.md @@ -0,0 +1,104 @@ +--- +id: 5efb23e70dc218d6c85f89b1 +title: Passo 37 +challengeType: 0 +dashedName: step-37 +--- + +# --description-- + +Existem muitos tipos de entradas (inputs) que você pode criar usando o atributo `type`. Você pode criar facilmente um campo de senha, um botão de redefinição ou um controle para permitir que os usuários selecionem um arquivo armazenado no computador. + +Crie um campo de texto para obter a entrada de texto de um usuário adicionando o atributo `type` com o valor `text` para o elemento `input`. + +# --hints-- + +Você excluiu o elemento `input` ou ele tem uma sintaxe inválida. Se você adicionou atributos, certifique-se de que seus valores estejam cercados por aspas. + +```js +assert($('input').length); +``` + +O elemento `form` deve conter apenas o elemento `input`. Remova os elementos HTML ou o texto adicionais entre as tags do elemento `form`. + +```js +assert( + $('form')[0].children.length === 1 && + $('form')[0].innerText.trim().length === 0 +); +``` + +O elemento `input` não tem o atributo `type` com o valor `text`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('input')[0].hasAttribute('type')); +``` + +O elemento `input` deve ter o atributo `type` com o valor `text`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert( + $('input')[0] + .getAttribute('type') + .replace(/\s+/g, ' ') + .match(/^text$/i) +); +``` + +Embora você tenha definido o atributo `type` do elemento `input` com o valor `text`, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\ + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efb2c990dc218d6c85f89b2.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efb2c990dc218d6c85f89b2.md new file mode 100644 index 00000000000..8d0542f8995 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efb2c990dc218d6c85f89b2.md @@ -0,0 +1,101 @@ +--- +id: 5efb2c990dc218d6c85f89b2 +title: Passo 42 +challengeType: 0 +dashedName: step-42 +--- + +# --description-- + +Mesmo que você tenha adicionado o botão abaixo do campo (input) de texto, eles aparecem um ao lado de outro na página. Isso ocorre porque os elementos `input` e `button` são elementos em linha (inline), que não aparecem em novas linhas. + +Você aprendeu anteriormente que o botão envia o formulário por padrão, mas você pode adicionar explicitamente o atributo `type` com o valor `submit` para tornar isso mais claro. Faça isso e especifique para onde o botão deve enviar o formulário. + +# --hints-- + +O elemento `button` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelector('button')); +``` + +O elemento `button` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/button\>/)); +``` + +O elemento `button` não tem um atributo `type`. Verifique se há um espaço depois do nome da tag de abertura. + +```js +assert($('button')[0].hasAttribute('type')); +``` + +O novo elemento `button` deve ter o atributo `type` com o valor `submit`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert( + $('button')[0] + .getAttribute('type') + .match(/^submit$/i) +); +``` + +Embora você tenha definido o atributo `type` do elemento `button` com o valor `submit`, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\<\s*button\s+type\s*=\s*submit/i.test(code)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+ +--fcc-editable-region-- + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc4f528d6a74d05e68af74.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc4f528d6a74d05e68af74.md new file mode 100644 index 00000000000..aabad180eab --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc4f528d6a74d05e68af74.md @@ -0,0 +1,136 @@ +--- +id: 5efc4f528d6a74d05e68af74 +title: Passo 55 +challengeType: 0 +dashedName: step-55 +--- + +# --description-- + +Existe outra maneira de associar o texto de um elemento `input` com o elemento em si. Você pode colocar o texto dentro de um elemento `label` e adicionar um atributo `for` com o mesmo valor que o atributo `id` do elemento `input`. + +Associe o texto `Loving` com a caixa de seleção simplesmente inserindo o texto `Loving` em um elemento `label` e coloque-o no lado direito do elemento `input` da caixa de seleção. + +# --hints-- + +Confira se a caixa de seleção ainda está presente. + +```js +assert($('input[type="checkbox"]')[0]); +``` + +A caixa de seleção deve ter o atributo `id` com o valor `loving`. Você pode ter removido o atributo ou alterado seu valor. + +```js +assert($('input[type="checkbox"]')[0].id === 'loving'); +``` + +O texto `Loving` não deve mais estar localizado diretamente à direita da caixa de seleção. Ele deve estar envolvido pelo elemento `label`. Certifique-se de que haja um espaço entre os dois elementos. + +```js +const checkboxInputElem = $('input[type="checkbox"]')[0]; +assert( + !checkboxInputElem.nextSibling.nodeValue + .replace(/\s+/g, ' ') + .match(/ Loving/i) +); +``` + +Você precisará adicionar um novo elemento `label` no qual aninhará o texto `Loving`. Certifique-se de que os dois tenham uma tag de abertura e fechamento. + +```js +assert( + document.querySelectorAll('label').length === 3 && + code.match(/<\/label\>/g).length === 3 +); +``` + +O novo elemento `label` deve estar localizado diretamente à direita da caixa de seleção. Certifique-se de que haja um espaço entre os dois elementos. + +```js +const checkboxInputElem = $('input[type="checkbox"]')[0]; +assert(checkboxInputElem.nextElementSibling.nodeName === 'LABEL'); +``` + +O novo elemento `label` não tem um atributo `for`. Verifique se há um espaço depois do nome da tag de abertura. + +```js +const labelElem = $('input[type="checkbox"]')[0].nextElementSibling; +assert(labelElem.hasAttribute('for')); +``` + +O novo elemento `label` deve ter o atributo `for` com o valor `loving`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +const labelElem = $('input[type="checkbox"]')[0].nextElementSibling; +assert(labelElem.getAttribute('for').match(/^loving$/)); +``` + +O texto `Loving` deve estar dentro do novo elemento `label`. Você omitiu o texto ou tem um erro de digitação. + +```js +const labelElem = document.querySelector('label[for="loving"]'); +assert(labelElem.textContent.replace(/\s/g, '').match(/Loving/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? +--fcc-editable-region-- + Loving +--fcc-editable-region-- +
+ + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc518e8d6a74d05e68af75.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc518e8d6a74d05e68af75.md new file mode 100644 index 00000000000..89c350f486e --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc518e8d6a74d05e68af75.md @@ -0,0 +1,98 @@ +--- +id: 5efc518e8d6a74d05e68af75 +title: Passo 56 +challengeType: 0 +dashedName: step-56 +--- + +# --description-- + +Adicione o atributo `name` com o valor `personality` no elemento `input` da caixa de seleção. + +Embora você não veja isso no navegador, fazer isso facilita para o servidor o processamento do formulário da web, especialmente quando há várias caixas de seleção. + +# --hints-- + +Confira se a caixa de seleção ainda está presente. + +```js +assert($('input[type="checkbox"]')[0]); +``` + +O elemento `input` da caixa de seleção não tem um atributo `name`. Verifique se há um espaço depois do nome da tag de abertura. + +```js +assert($('input[type="checkbox"]')[0].hasAttribute('name')); +``` + +O elemento `input` da caixa de seleção deve ter o atributo `name` com o valor `personality`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert( + $('input[type="checkbox"]')[0] + .getAttribute('name') + .match(/^personality$/) +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? +--fcc-editable-region-- + +--fcc-editable-region-- +
+ + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc54138d6a74d05e68af76.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc54138d6a74d05e68af76.md new file mode 100644 index 00000000000..d4ee3926659 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc54138d6a74d05e68af76.md @@ -0,0 +1,86 @@ +--- +id: 5efc54138d6a74d05e68af76 +title: Passo 54 +challengeType: 0 +dashedName: step-54 +--- + +# --description-- + +Adicione o atributo `id` com o valor `loving` para a caixa de seleção. + +# --hints-- + +A caixa de seleção deve ter um atributo `id`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('input[type="checkbox"]')[0].hasAttribute('id')); +``` + +A caixa de seleção deve ter o atributo `id` com o valor `loving`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert($('input[type="checkbox"]')[0].id.match(/^loving$/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? +--fcc-editable-region-- + Loving +--fcc-editable-region-- +
+ + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc575c8d6a74d05e68af77.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc575c8d6a74d05e68af77.md new file mode 100644 index 00000000000..ed7277fc0db --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc575c8d6a74d05e68af77.md @@ -0,0 +1,124 @@ +--- +id: 5efc575c8d6a74d05e68af77 +title: Passo 58 +challengeType: 0 +dashedName: step-58 +--- + +# --description-- + +Adicione uma caixa de seleção final após a anterior com um atributo `id` com o valor `energetic`. O atributo `name` deve ser o mesmo que o da caixa de seleção anterior. + +Adicione também um elemento `label` à direita da nova caixa de seleção com o texto `Energetic`. Certifique-se de associar o elemento `label` à nova caixa de seleção. + +# --hints-- + +Você precisa adicionar uma nova caixa de seleção. + +```js +assert($('input[type="checkbox"]').length === 3); +``` + +A nova caixa de seleção deve ter um atributo `id` com o valor `energetic` e um atributo `name` com o valor `personality`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +const checkboxes = [...$('input[type="checkbox"]')]; +assert( + checkboxes.some( + (checkbox) => + checkbox.id === 'energetic' && + checkbox.getAttribute('name') === 'personality' + ) +); +``` + +A nova caixa de seleção deve vir depois da segunda. Elas estão na ordem errada. + +```js +const checkboxes = [...$('input[type="checkbox"]')].map( + (checkbox) => checkbox.id +); +assert(checkboxes.indexOf('lazy') < checkboxes.indexOf('energetic')); +``` + +No lado direito da nova caixa de seleção, deve haver um elemento `label` com o texto `Energetic`. + +```js +const nextElementSibling = $('input[type="checkbox"]')[2].nextElementSibling; +assert( + nextElementSibling.nodeName === 'LABEL' && + nextElementSibling.innerText.replace(/\s+/g, '').match(/^Energetic$/i) +); +``` + +O novo `label` deve ter um atributo `for` com o mesmo valor que o atributo `id` da nova caixa de seleção. Você omitiu o valor ou tem um erro de digitação. + +```js +assert( + $('input[type="checkbox"]')[2].nextElementSibling.getAttribute('for') === + 'energetic' +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? +--fcc-editable-region-- + + +--fcc-editable-region-- +
+ + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f05a1d8e233dff4a68508d8.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f05a1d8e233dff4a68508d8.md new file mode 100644 index 00000000000..5cc3d741801 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f05a1d8e233dff4a68508d8.md @@ -0,0 +1,107 @@ +--- +id: 5f05a1d8e233dff4a68508d8 +title: Passo 46 +challengeType: 0 +dashedName: step-46 +--- + +# --description-- + +Coloque outro botão de opção com a opção `Outdoor` em um novo elemento `label`. O novo botão de opção deve ser colocado depois do primeiro. Além disso, defina o valor do atributo `id` como `outdoor`. + +# --hints-- + +Você precisará adicionar um novo elemento `label` no qual aninhará o novo botão de opção. Certifique-se de que os dois tenham uma tag de abertura e fechamento. + +```js +assert( + document.querySelectorAll('label').length === 2 && + code.match(/<\/label\>/g).length === 2 +); +``` + +O texto `Outdoor` deve estar localizado diretamente à direita do novo botão `radio`. Certifique-se de que haja um espaço entre o elemento e o texto. Você omitiu o texto ou tem um erro de digitação. + +```js +const radioButtons = [...$('input')]; +assert( + radioButtons.filter((btn) => + btn.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Outdoor/i) + ).length +); +``` + +O novo botão de opção e o rótulo (label) associado a ele devem estar abaixo do primeiro botão. Eles estão na ordem errada. + +```js +const collection = [ + ...document.querySelectorAll('input[type="radio"]') +].map((node) => node.nextSibling.nodeValue.replace(/\s+/g, '')); +assert(collection.indexOf('Indoor') < collection.indexOf('Outdoor')); +``` + +O novo botão de opção deve ter um atributo `id`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('input')[1].hasAttribute('id')); +``` + +O novo elemento de botão de opção deve ter o atributo `id` com o valor `outdoor`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert($('input')[1].id.match(/^outdoor$/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07be6ef7412fbad0c5626b.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07be6ef7412fbad0c5626b.md new file mode 100644 index 00000000000..3fc604a6834 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07be6ef7412fbad0c5626b.md @@ -0,0 +1,63 @@ +--- +id: 5f07be6ef7412fbad0c5626b +title: Passo 15 +challengeType: 0 +dashedName: step-15 +--- + +# --description-- + +Antes de adicionar conteúdo novo, você deve usar um elemento `section` para separar o conteúdo de fotos de gatos do resto do conteúdo. + +Pegue todos os elementos atualmente localizados no elemento `main` e aninhe-os em um elemento `section`. + +# --hints-- + +O elemento `section` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelector('section')); +``` + +O elemento `section` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/section\>/)); +``` + +Todo o elemento `section` deve estar dentro das tags de abertura e fechamento do elemento `main`. + +```js +assert(document.querySelector('section').parentNode.nodeName === 'MAIN'); +``` + +O elemento `h2`, o comentário, o elemento `p` e o elemento de âncora (`a`) devem estar entre as tags de abertura e fechamento do elemento `section`. + +```js +const childrenOfSection = [...document.querySelector('section').childNodes]; +const foundElems = childrenOfSection.filter((child) => { + return ['H2', 'A', 'P'].includes(child.nodeName); +}); +assert(foundElems.length === 3); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+--fcc-editable-region-- +
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+--fcc-editable-region-- + + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07c98cdb9413cbd4b16750.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07c98cdb9413cbd4b16750.md new file mode 100644 index 00000000000..29af9796db1 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07c98cdb9413cbd4b16750.md @@ -0,0 +1,81 @@ +--- +id: 5f07c98cdb9413cbd4b16750 +title: Passo 16 +challengeType: 0 +dashedName: step-16 +--- + +# --description-- + +É hora de adicionar uma nova seção. Adicione um segundo elemento `section` abaixo do elemento `section` existente. + +# --hints-- + +O elemento `section` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('section').length >= 2); +``` + +Você deve acrescentar apenas uma tag de abertura para `section`. Remova as tags adicionais. + +```js +assert(document.querySelectorAll('section').length === 2); +``` + +O elemento `section` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/section>/g).length >= 2); +``` + +Você deve acrescentar apenas uma tag de fechamento para `section`. Remova as tags adicionais. + +```js +assert(code.match(/<\/section>/g).length === 2); +``` + +O segundo elemento `section` não deve estar dentro do primeiro elemento `section`. + +```js +const childrenOf1stSection = [ + ...document.querySelector('main > section').children +]; +const foundElems = childrenOf1stSection.filter((child) => { + return child.nodeName === 'SECTION'; +}); +assert(foundElems.length === 0); +``` + +Os dois elementos `section` devem estar dentro das tags de abertura e fechamento do elemento `main`. + +```js +const childrenOfMain = [...document.querySelector('main').children]; +const foundElems = childrenOfMain.filter((child) => { + return child.nodeName === 'SECTION'; +}); +assert(foundElems.length === 2); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+--fcc-editable-region-- +
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07fb1579dc934717801375.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07fb1579dc934717801375.md new file mode 100644 index 00000000000..c3c3346aeef --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f07fb1579dc934717801375.md @@ -0,0 +1,98 @@ +--- +id: 5f07fb1579dc934717801375 +title: Passo 32 +challengeType: 0 +dashedName: step-32 +--- + +# --description-- + +É hora de adicionar uma nova seção. Adicione um terceiro elemento `section` abaixo do segundo elemento `section` existente. + +# --hints-- + +O elemento `section` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('section').length >= 3); +``` + +Você deve acrescentar apenas uma tag de abertura para `section`. Remova as tags adicionais. + +```js +assert(document.querySelectorAll('section').length === 3); +``` + +O elemento `section` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/section>/g).length >= 3); +``` + +Você deve acrescentar apenas uma tag de fechamento para `section`. Remova as tags adicionais. + +```js +assert(code.match(/<\/section>/g).length === 3); +``` + +Todos os elementos `section` devem estar dentro das tags de abertura e fechamento do elemento `main`. + +```js +const childrenOfMain = [...document.querySelector('main').children]; +const sectionElemsFound = childrenOfMain.filter((child) => { + return child.nodeName === 'SECTION'; +}); +assert(sectionElemsFound.length === 3); +``` + +O último elemento `section` não deve ter conteúdo. Remova os elementos HTML ou o texto dentro do elemento `section`. + +```js +assert($('main > section')[2].children.length === 0); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+--fcc-editable-region-- +
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+--fcc-editable-region-- +
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d48e7b435f13ab6550051.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d48e7b435f13ab6550051.md new file mode 100644 index 00000000000..b9dba1b10e5 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d48e7b435f13ab6550051.md @@ -0,0 +1,105 @@ +--- +id: 5f0d48e7b435f13ab6550051 +title: Passo 50 +challengeType: 0 +dashedName: step-50 +--- + +# --description-- + +O elemento `legend` atua como uma legenda para o conteúdo do elemento `fieldset`. Ele dá aos usuários um contexto sobre o que devem inserir nessa parte do formulário. + +Adicione um elemento `legend` com o texto `Is your cat an indoor or outdoor cat?` acima dos dois botões de opção. + +# --hints-- + +O elemento `legend` deve ter uma tag de abertura. As tags de abertura têm a seguinte sintaxe: ``. + +```js +assert(document.querySelector('legend')); +``` + +O elemento `legend` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/legend\>/)); +``` + +O elemento `legend` deve ser o primeiro elemento logo abaixo da tag de abertura do elemento `fieldset` e antes da tag de abertura do `label` do primeiro botão de opção. Ele não está na posição correta. + +```js +const fieldsetElem = document.querySelector('fieldset'); +const fieldsetElemChildren = fieldsetElem.children; +assert( + fieldsetElem.firstElementChild.nodeName === 'LEGEND' && + fieldsetElemChildren[1].nodeName === 'LABEL' && + fieldsetElemChildren[1].children[0].nodeName === 'INPUT' && + fieldsetElemChildren[1].children[0].id === 'indoor' +); +``` + +O texto do elemento `legend` deve ser `Is your cat an indoor or outdoor cat?`. Você omitiu o texto, digitou o texto incorretamente ou ele não está entre as tags de abertura e fechamento do elemento `legend`. + +```js +const extraSpacesRemoved = document + .querySelector('legend') + .innerText.replace(/\s+/g, ' '); +assert(extraSpacesRemoved.match(/Is your cat an indoor or outdoor cat\??$/i)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- +
+ + +
+--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d4ab1b435f13ab6550052.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d4ab1b435f13ab6550052.md new file mode 100644 index 00000000000..72660f140a5 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d4ab1b435f13ab6550052.md @@ -0,0 +1,128 @@ +--- +id: 5f0d4ab1b435f13ab6550052 +title: Passo 51 +challengeType: 0 +dashedName: step-51 +--- + +# --description-- + +Em seguida, você vai adicionar alguns novos elementos `input` ao formulário. Adicione outro elemento `fieldset` diretamente abaixo do elemento `fieldset` existente. + +# --hints-- + +O novo elemento `fieldset` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +assert(document.querySelectorAll('fieldset').length >= 2); +``` + +Você deve acrescentar apenas uma tag de abertura para `fieldset`. Remova as tags adicionais. + +```js +assert(document.querySelectorAll('fieldset').length === 2); +``` + +O novo elemento `fieldset` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/fieldset>/g).length >= 2); +``` + +Você deve acrescentar apenas uma tag de fechamento para `fieldset`. Remova as tags adicionais. + +```js +assert(code.match(/<\/fieldset>/g).length === 2); +``` + +O segundo elemento `fieldset` não deve estar dentro do primeiro elemento `fieldset`. + +```js +const childrenOf1stFieldset = [ + ...document.querySelector('form > fieldset').children +]; +const foundElems = childrenOf1stFieldset.filter((child) => { + return child.nodeName === 'FIELDSET'; +}); +assert(foundElems.length === 0); +``` + +Os dois elementos `fieldset` devem estar acima do campo de texto e de seu elemento `label` associado. Eles estão fora de ordem. + +```js +const formChildren = $('form')[0].children; +assert( + formChildren[0].nodeName === 'FIELDSET' && + formChildren[1].nodeName === 'FIELDSET' && + formChildren[2] && + formChildren[2].nodeName === 'INPUT' && + formChildren[2].getAttribute('type') === 'text' +); +``` + +O novo elemento `fieldset` não deve estar abaixo do elemento `fieldset` existente. Eles estão na ordem errada. + +```js +const fieldsetChildren = [...document.querySelectorAll('fieldset')].map( + (elem) => elem.children +); +assert(fieldsetChildren[0].length > fieldsetChildren[1].length); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- +
+ Is your cat an indoor or outdoor cat? + + +
+ + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d4d04b435f13ab6550053.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d4d04b435f13ab6550053.md new file mode 100644 index 00000000000..4fffc1dc065 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d4d04b435f13ab6550053.md @@ -0,0 +1,114 @@ +--- +id: 5f0d4d04b435f13ab6550053 +title: Passo 52 +challengeType: 0 +dashedName: step-52 +--- + +# --description-- + +Adicione um elemento `legend` com o texto `What's your cat's personality?` dentro do segundo elemento `fieldset`. + +# --hints-- + +Você excluiu o segundo elemento `fieldset` ou está faltando nele uma tag de abertura ou fechamento. + +```js +assert( + document.querySelectorAll('fieldset').length === 2 && + code.match(/<\/fieldset>/g).length === 2 +); +``` + +O elemento `legend` deve ter uma tag de abertura. As tags de abertura têm essa sintaxe: ``. + +```js +const secondFieldset = $('fieldset')[1]; +assert( + secondFieldset && + [...secondFieldset.children].filter((child) => child.nodeName === 'LEGEND') + .length +); +``` + +O elemento `legend` deve ter uma tag de fechamento. As tags de fechamento têm um caractere `/` logo após o caractere `<`. + +```js +assert(code.match(/<\/legend\>/g).length === 2); +``` + +O elemento `legend` deve ter o texto `What's your cat's personality?`. Você omitiu o texto ou tem um erro de digitação. + +```js +const secondFieldset = $('fieldset')[1]; +assert( + secondFieldset && + [...secondFieldset.children].filter((child) => { + const extraSpacesRemoved = child.innerText.replace(/\s+/g, ' '); + return ( + child.nodeName === 'LEGEND' && + extraSpacesRemoved.match(/What's your cat's personality\??$/i) + ); + }).length +); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+
+ Is your cat an indoor or outdoor cat? + + +
+--fcc-editable-region-- +
+
+--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f1a80975fc4bcae0edb3497.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f1a80975fc4bcae0edb3497.md new file mode 100644 index 00000000000..bee36ec339f --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f1a80975fc4bcae0edb3497.md @@ -0,0 +1,101 @@ +--- +id: 5f1a80975fc4bcae0edb3497 +title: Passo 48 +challengeType: 0 +dashedName: step-48 +--- + +# --description-- + +Se você selecionar o botão de opção `Indoor` e enviar o formulário, os dados de formulário para o botão são baseados em seus atributos `name` e `value`. Como seus botões de opção não têm um atributo `value`, os dados do formulário incluirão `indoor-outdoor=on`, o que não é útil quando você tem vários botões. + +Adicione um atributo `value` para os dois botões de opção. Por conveniência, defina o atributo `value` do botão com o mesmo valor do atributo `id`. + +# --hints-- + +Os dois botões de opção ainda devem estar localizados entre as tags de abertura e de fechamento do elemento `label`. + +```js +const labelChildNodes = [...document.querySelectorAll('form > label')].map( + (node) => node.childNodes +); +assert( + labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT') + .length === 2 +); +``` + +Os dois botões de opção devem ter um atributo `value`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +const radioButtons = [...document.querySelectorAll('input[type="radio"]')]; +assert(radioButtons.every((btn) => btn.hasAttribute('value'))); +``` + +O atributo `value` do botão de opção `Indoor` deve estar definido como `indoor`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +const indoorRadioButton = document.querySelector('#indoor'); +assert(indoorRadioButton.getAttribute('value').match(/^indoor$/)); +``` + +O atributo `value` do botão de opção `Outdoor` deve estar definido como `outdoor`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +const outdoorRadioButton = document.querySelector('#outdoor'); +assert(outdoorRadioButton.getAttribute('value').match(/^outdoor$/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + + +--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f1a89f1190aff21ae42105a.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f1a89f1190aff21ae42105a.md new file mode 100644 index 00000000000..a08763bf0dc --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f1a89f1190aff21ae42105a.md @@ -0,0 +1,106 @@ +--- +id: 5f1a89f1190aff21ae42105a +title: Passo 59 +challengeType: 0 +dashedName: step-59 +--- + +# --description-- + +Assim como os botões de opção, os dados de formulário para caixas de seleção marcadas são o par de atributos `name`/`value`. Embora o atributo `value` seja opcional, é melhor incluí-lo com todas as caixas de seleção ou botões de opção da página. + +Adicione um atributo `value` a cada caixa de seleção. Por conveniência, defina o atributo `value` de cada caixa de seleção com o mesmo valor do atributo `id`. + +# --hints-- + +As três caixas de seleção devem ter um atributo `value`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +const checkboxes = [...document.querySelectorAll('input[type="checkbox"]')]; +assert(checkboxes.every((checkbox) => checkbox.hasAttribute('value'))); +``` + +O atributo `value` da caixa de seleção `Loving` deve ser definido como `loving`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +const lovingCheckbox = document.querySelector('#loving'); +assert(lovingCheckbox.getAttribute('value').match(/^loving$/)); +``` + +O atributo `value` da caixa de seleção `Lazy` deve ser definido como `lazy`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +const lazyCheckbox = document.querySelector('#lazy'); +assert(lazyCheckbox.getAttribute('value').match(/^lazy$/)); +``` + +O atributo `value` da caixa de seleção `Energetic` deve ser definido como `energetic`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +const energeticCheckbox = document.querySelector('#energetic'); +assert(energeticCheckbox.getAttribute('value').match(/^energetic$/)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- +
+ Is your cat an indoor or outdoor cat? + + +
+
+ What's your cat's personality? + + + +
+--fcc-editable-region-- + + +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/7cf9b03d81a65668421804c3.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/7cf9b03d81a65668421804c3.md new file mode 100644 index 00000000000..139ba990a7c --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/7cf9b03d81a65668421804c3.md @@ -0,0 +1,103 @@ +--- +id: 7cf9b03d81a65668421804c3 +title: Passo 38 +challengeType: 0 +dashedName: step-38 +--- + +# --description-- + +Para que os dados de um formulário sejam acessados pelo local especificado no atributo `action`, você deve dar ao campo de texto um atributo `name` e atribuir a ele um valor que represente os dados que estão sendo enviados. Por exemplo, você pode usar a sintaxe a seguir para um campo de texto de endereço de e-mail: ``. + +Adicione o atributo `name` com o valor `catphotourl` para o campo de texto. + +# --hints-- + +Você excluiu o elemento `input` ou ele tem uma sintaxe inválida. Os valores de todos os atributos devem estar cercados com aspas. + +```js +assert($('input').length); +``` + +O elemento `form` deve conter apenas o elemento `input`. Remova os elementos HTML ou o texto adicionais do elemento `form`. + +```js +assert( + $('form')[0].children.length === 1 && + $('form')[0].innerText.trim().length === 0 +); +``` + +O elemento `input` não tem um atributo `name`. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos. + +```js +assert($('input')[0].hasAttribute('name')); +``` + +O elemento `input` deve ter um atributo `name` com o valor `catphotourl`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas. + +```js +assert( + $('input')[0] + .getAttribute('name') + .match(/^catphotourl$/i) +); +``` + +Embora você tenha definido o atributo `name` do elemento `input` com o valor `catphotourl`, é recomendável sempre cercar o valor de um atributo com aspas. + +```js +assert(!/\<\s*input\s+.*\s*=\s*catphotourl/.test(code)); +``` + +# --seed-- + +## --seed-contents-- + +```html + + +

CatPhotoApp

+
+
+

Cat Photos

+ +

Click here to view more cat photos.

+ A cute orange cat lying on its back. +
+
+

Cat Lists

+

Things cats love:

+
    +
  • cat nip
  • +
  • laser pointers
  • +
  • lasagna
  • +
+
+ A slice of lasagna on a plate. +
Cats love lasagna.
+
+

Top 3 things cats hate:

+
    +
  1. flea treatment
  2. +
  3. thunder
  4. +
  5. other cats
  6. +
+
+ Five cats looking around a field. +
Cats hate other cats.
+
+
+
+

Cat Form

+
+--fcc-editable-region-- + +--fcc-editable-region-- +
+
+
+ + +``` + diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f2d4150fe0d4cbd0f2628.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f2d4150fe0d4cbd0f2628.md new file mode 100644 index 00000000000..cbed848cba9 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f2d4150fe0d4cbd0f2628.md @@ -0,0 +1,60 @@ +--- +id: 615f2d4150fe0d4cbd0f2628 +title: Passo 2 +challengeType: 0 +dashedName: step-2 +--- + +# --description-- + +Abaixo do elemento `h1`, adicione um elemento `p` com o texto `8 servings per container`. + +# --hints-- + +Você deve adicionar um novo elemento `p`. + +```js +assert.exists(document.querySelector('p')); +``` + +O elemento `p` deve estar dentro do elemento `body`. + +```js +assert(document.querySelector('p')?.parentElement?.localName === 'body'); +``` + +O elemento `p` deve vir depois do elemento `h1`. + +```js +assert(document.querySelector('p')?.previousElementSibling?.localName === 'h1'); +``` + +O elemento `p` deve ter o texto `8 servings per container`. + +```js +assert(document.querySelector('p')?.innerText === '8 servings per container'); +``` + +# --seed-- + +## --seed-contents-- + +```html +--fcc-editable-region-- + + + + + Nutrition Label + + +

Nutrition Facts

+ + + +--fcc-editable-region-- +``` + +```css + +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3d9e59db4b5b8e960762.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3d9e59db4b5b8e960762.md new file mode 100644 index 00000000000..5c4bed1b79b --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3d9e59db4b5b8e960762.md @@ -0,0 +1,68 @@ +--- +id: 615f3d9e59db4b5b8e960762 +title: Passo 13 +challengeType: 0 +dashedName: step-13 +--- + +# --description-- + +Dê ao seletor `h1` a propriedade `text-align` com o atributo de `center`. + +# --hints-- + +O seletor `h1` deve definir a propriedade `text-align` como `center`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('h1')?.textAlign === 'center'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +
+

Nutrition Facts

+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+ + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +--fcc-editable-region-- +h1 { + font-weight: 800; +} +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3e1b7233ee5c7595771f.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3e1b7233ee5c7595771f.md new file mode 100644 index 00000000000..ff621856643 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3e1b7233ee5c7595771f.md @@ -0,0 +1,69 @@ +--- +id: 615f3e1b7233ee5c7595771f +title: Passo 14 +challengeType: 0 +dashedName: step-14 +--- + +# --description-- + +Ajuste o posicionamento do `h1` dando-lhe uma margem superior e inferior de `-4px` e uma margem esquerda e direita de `0`. + +# --hints-- + +O seletor `h1` deve ter uma propriedade `margin` definida como `-4px 0`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('h1')?.margin === '-4px 0px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +
+

Nutrition Facts

+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+ + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +--fcc-editable-region-- +h1 { + font-weight: 800; + text-align: center; +} +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3e4af8008c5d494d3afe.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3e4af8008c5d494d3afe.md new file mode 100644 index 00000000000..c83a4c2ae32 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3e4af8008c5d494d3afe.md @@ -0,0 +1,78 @@ +--- +id: 615f3e4af8008c5d494d3afe +title: Passo 15 +challengeType: 0 +dashedName: step-15 +--- + +# --description-- + +Crie um seletor `p` e remova todas as margens. + +# --hints-- + +Você deve criar um seletor `p`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('p')); +``` + +O seletor `p` deve ter uma propriedade `margin` definida como `0`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('p')?.margin === '0px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +
+

Nutrition Facts

+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+ + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +h1 { + font-weight: 800; + text-align: center; + margin: -4px 0; +} + +--fcc-editable-region-- + +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3ed16592445e57941aec.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3ed16592445e57941aec.md new file mode 100644 index 00000000000..87d47d2f990 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f3ed16592445e57941aec.md @@ -0,0 +1,94 @@ +--- +id: 615f3ed16592445e57941aec +title: Passo 16 +challengeType: 0 +dashedName: step-16 +--- + +# --description-- + +Linhas podem ajudar a separar e agrupar conteúdos importantes, especialmente quando o espaço é limitado. + +Crie um elemento `div` abaixo do elemento `h1` e dê a ele um atributo de `class` definido como `divider`. + +# --hints-- + +Você deve criar um novo `div`. + +```js +assert(document.querySelectorAll('div')?.length === 2); +``` + +O novo elemento `div` deve ter o atributo `class` definido como `divider`. + +```js +assert(document.querySelectorAll('div')?.[1]?.classList?.contains('divider')); +``` + +O elemento `.divider` deve estar dentro do elemento `.label`. + +```js +assert(document.querySelector('.label')?.querySelector('.divider')); +``` + +O elemento `.divider` deve vir depois do elemento `h1`. + +```js +assert(document.querySelector('.divider')?.previousElementSibling?.localName === 'h1'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +--fcc-editable-region-- +
+

Nutrition Facts

+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+--fcc-editable-region-- + + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +h1 { + font-weight: 800; + text-align: center; + margin: -4px 0; +} + +p { + margin: 0; +} +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4bfb9de4a16703b56eb6.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4bfb9de4a16703b56eb6.md new file mode 100644 index 00000000000..dab1f34db2a --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4bfb9de4a16703b56eb6.md @@ -0,0 +1,94 @@ +--- +id: 615f4bfb9de4a16703b56eb6 +title: Passo 23 +challengeType: 0 +dashedName: step-23 +--- + +# --description-- + +A propriedade `float` é usada para colocar um elemento à esquerda ou à direita de seu contêiner, permitindo que outro conteúdo (como texto) seja encapsulado em torno dele. + +Crie um novo seletor `.right` e defina a propriedade `float` para `right`. + +# --hints-- + +Você deve criar um novo seletor `.right`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('.right')); +``` + +O seletor `.right` deve ter uma propriedade `float` definida como `right`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('.right')?.float === 'right'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +
+

Nutrition Facts

+
+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+ + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +h1 { + text-align: center; + margin: -4px 0; + letter-spacing: 0.15px +} + +p { + margin: 0; +} + +.divider { + border-bottom: 1px solid #888989; + margin: 2px 0; +} + +.bold { + font-weight: 800; +} + +--fcc-editable-region-- + +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4ce9d877b668417c0c42.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4ce9d877b668417c0c42.md new file mode 100644 index 00000000000..f863d79939c --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4ce9d877b668417c0c42.md @@ -0,0 +1,104 @@ +--- +id: 615f4ce9d877b668417c0c42 +title: Passo 24 +challengeType: 0 +dashedName: step-24 +--- + +# --description-- + +Encapsule tudo dentro do elemento `.label` em um novo elemento `header`. + +# --hints-- + +Você deve criar um novo elemento `header`. + +```js +assert(document.querySelector('header')); +``` + +O elemento `header` deve estar dentro do elemento `.label`. + +```js +assert(document.querySelector('header')?.parentElement?.classList?.contains('label')); +``` + +Os elementos `h1`, `div` e `p` devem estar dentro do novo elemento `header`. + +```js +const children = document.querySelector('header')?.children; +assert(children?.[0]?.localName === 'h1'); +assert(children?.[1]?.localName === 'div'); +assert(children?.[2]?.localName === 'p'); +assert(children?.[3]?.localName === 'p'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +--fcc-editable-region-- +
+

Nutrition Facts

+
+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+--fcc-editable-region-- + + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +h1 { + text-align: center; + margin: -4px 0; + letter-spacing: 0.15px +} + +p { + margin: 0; +} + +.divider { + border-bottom: 1px solid #888989; + margin: 2px 0; +} + +.bold { + font-weight: 800; +} + +.right { + float: right; +} +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4dde9d72e3694cb9ee3b.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4dde9d72e3694cb9ee3b.md new file mode 100644 index 00000000000..07c25f6f648 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4dde9d72e3694cb9ee3b.md @@ -0,0 +1,105 @@ +--- +id: 615f4dde9d72e3694cb9ee3b +title: Passo 25 +challengeType: 0 +dashedName: step-25 +--- + +# --description-- + +Agora atualize o seletor `h1` para que seja `header h1` e tenha como destino o elemento `h1` dentro do novo `header`. + +# --hints-- + +Você deve ter um seletor `header h1`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('header h1')); +``` + +Você não deve ter um seletor `h1`. + +```js +assert.isNull(new __helpers.CSSHelp(document).getStyle('h1')); +``` + +Você não deve alterar nenhuma propriedade no seletor. + +```js +const style = new __helpers.CSSHelp(document).getStyle('header h1'); +assert(style?.textAlign === 'center'); +assert(style?.margin === '-4px 0px'); +assert(style?.letterSpacing === '0.15px'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +
+
+

Nutrition Facts

+
+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+
+ + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +--fcc-editable-region-- +h1 { + text-align: center; + margin: -4px 0; + letter-spacing: 0.15px +} +--fcc-editable-region-- + +p { + margin: 0; +} + +.divider { + border-bottom: 1px solid #888989; + margin: 2px 0; +} + +.bold { + font-weight: 800; +} + +.right { + float: right; +} +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4ec58334106a4170c2a8.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4ec58334106a4170c2a8.md new file mode 100644 index 00000000000..19123e60a36 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4ec58334106a4170c2a8.md @@ -0,0 +1,105 @@ +--- +id: 615f4ec58334106a4170c2a8 +title: Passo 26 +challengeType: 0 +dashedName: step-26 +--- + +# --description-- + +Crie um novo elemento `div` abaixo de seu elemento `header`, e dê a a ele uma atributo de `class` definido como `divider lg`. + +# --hints-- + +Você deve criar um novo elemento `div`. + +```js +assert(document.querySelectorAll('div')?.length === 3); +``` + +O novo elemento `div` deve estar depois do elemento `header`. + +```js +assert(document.querySelector('.label')?.lastElementChild?.localName === 'div'); +``` + +O novo elemento `div` deve ter o atributo `class` definido como `divider lg`. + +```js +const div = document.querySelector('.label')?.lastElementChild; +assert(div?.classList?.contains('divider')); +assert(div?.classList?.contains('lg')); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +
+
+

Nutrition Facts

+
+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+--fcc-editable-region-- + +--fcc-editable-region-- +
+ + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +header h1 { + text-align: center; + margin: -4px 0; + letter-spacing: 0.15px +} + +p { + margin: 0; +} + +.divider { + border-bottom: 1px solid #888989; + margin: 2px 0; +} + +.bold { + font-weight: 800; +} + +.right { + float: right; +} +``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4f9e4a40566b776a8f38.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4f9e4a40566b776a8f38.md new file mode 100644 index 00000000000..383b5bc1c11 --- /dev/null +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f4f9e4a40566b776a8f38.md @@ -0,0 +1,111 @@ +--- +id: 615f4f9e4a40566b776a8f38 +title: Passo 27 +challengeType: 0 +dashedName: step-27 +--- + +# --description-- + +Crie um novo seletor `.lg` e defina a propriedade `height` para `10px`. Também crie um seletor `.lg, .md` e defina a propriedade `background-color` como `black`. + +# --hints-- + +Você deve ter um novo seletor `.lg`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('.lg')); +``` + +O seletor `.lg` deve ter a propriedade `height` definida como `10px`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('.lg')?.height === '10px'); +``` + +Você deve ter um novo seletor `.lg, .md`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('.lg, .md')); +``` + +O seletor `.lg, .md` deve ter a propriedade `background-color` definida como `black`. + +```js +assert(new __helpers.CSSHelp(document).getStyle('.lg, .md')?.backgroundColor === 'black'); +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + Nutrition Label + + + + +
+
+

Nutrition Facts

+
+

8 servings per container

+

Serving size 2/3 cup (55g)

+
+
+
+ + +``` + +```css +* { + box-sizing: border-box; +} + +html { + font-size: 16px; +} + +body { + font-family: 'Open Sans', sans-serif; +} + +.label { + border: 2px solid black; + width: 270px; + margin: 20px auto; + padding: 0 7px; +} + +header h1 { + text-align: center; + margin: -4px 0; + letter-spacing: 0.15px +} + +p { + margin: 0; +} + +.divider { + border-bottom: 1px solid #888989; + margin: 2px 0; +} + +.bold { + font-weight: 800; +} + +.right { + float: right; +} + +--fcc-editable-region-- + +--fcc-editable-region-- +```