chore(curriculum): Remove files in wrong format
This commit is contained in:
@ -0,0 +1,81 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedd08830
|
||||
title: Add a Submit Button to a Form
|
||||
challengeType: 0
|
||||
guideUrl: 'https://guide.freecodecamp.org/certificates/add-a-submit-button-to-a-form'
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cp2Nkhz'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Let's add a <code>submit</code> button to your form. Clicking this button will send the data from your form to the URL you specified with your form's <code>action</code> attribute.
|
||||
Here's an example submit button:
|
||||
<code><button type="submit">this button submits the form</button></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add a button as the last element of your <code>form</code> element with a type of <code>submit</code>, and "Submit" as its text.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your form should have a button inside it.
|
||||
testString: 'assert($("form").children("button").length > 0, ''Your form should have a button inside it.'');'
|
||||
- text: Your submit button should have the attribute <code>type</code> set to <code>submit</code>.
|
||||
testString: 'assert($("button").attr("type") === "submit", ''Your submit button should have the attribute <code>type</code> set to <code>submit</code>.'');'
|
||||
- text: Your submit button should only have the text "Submit".
|
||||
testString: 'assert($("button").text().match(/^\s*submit\s*$/gi), ''Your submit button should only have the text "Submit".'');'
|
||||
- text: Make sure your <code>button</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/button>/g) && code.match(/<button/g) && code.match(/<\/button>/g).length === code.match(/<button/g).length, ''Make sure your <code>button</code> element has a closing tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
<form action="/submit-cat-photo">
|
||||
<input type="text" placeholder="cat photo URL">
|
||||
</form>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,74 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08812
|
||||
title: Add Images to Your Website
|
||||
challengeType: 0
|
||||
guideUrl: 'https://guide.freecodecamp.org/certificates/add-images-to-your-website'
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/c8EbJf2'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can add images to your website by using the <code>img</code> element, and point to a specific image's URL using the <code>src</code> attribute.
|
||||
An example of this would be:
|
||||
<code><img src="https://www.your-image-source.com/your-image.jpg"></code>
|
||||
Note that <code>img</code> elements are self-closing.
|
||||
All <code>img</code> elements <strong>must</strong> have an <code>alt</code> attribute. The text inside an <code>alt</code> attribute is used for screen readers to improve accessibility and is displayed if the image fails to load.
|
||||
Note: If the image is purely decorative, using an empty <code>alt</code> attribute is a best practice.
|
||||
Ideally the <code>alt</code> attribute should not contain special characters unless needed.
|
||||
Let's add an <code>alt</code> attribute to our <code>img</code> example above:
|
||||
<code><img src="https://www.your-image-source.com/your-image.jpg" alt="Author standing on a beach with two thumbs up."></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Let's try to add an image to our website:
|
||||
Insert an <code>img</code> tag, before the <code>h2</code> element.
|
||||
Now set the <code>src</code> attribute so that it points to this url:
|
||||
<code>https://bit.ly/fcc-relaxing-cat</code>
|
||||
Finally don't forget to give your image an <code>alt</code> text.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your page should have an image element.
|
||||
testString: 'assert($("img").length > 0, ''Your page should have an image element.'');'
|
||||
- text: Your image should have a <code>src</code> attribute that points to the kitten image.
|
||||
testString: 'assert(new RegExp("\/\/bit.ly\/fcc-relaxing-cat|\/\/s3.amazonaws.com\/freecodecamp\/relaxing-cat.jpg", "gi").test($("img").attr("src")), ''Your image should have a <code>src</code> attribute that points to the kitten image.'');'
|
||||
- text: Your image element <strong>must</strong> have an <code>alt</code> attribute.
|
||||
testString: 'assert(code.match(/alt\s*?=\s*?(\"|\'').*(\"|\'')/), ''Your image element <strong>must</strong> have an <code>alt</code> attribute.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,77 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08830
|
||||
title: Add Placeholder Text to a Text Field
|
||||
challengeType: 0
|
||||
guideUrl: 'https://guide.freecodecamp.org/certificates/add-placeholder-text-to-a-text-field'
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cKdJDhg'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Placeholder text is what is displayed in your <code>input</code> element before your user has inputted anything.
|
||||
You can create placeholder text like so:
|
||||
<code><input type="text" placeholder="this is placeholder text"></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Set the <code>placeholder</code> value of your text <code>input</code> to "cat photo URL".
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.
|
||||
testString: 'assert($("input[placeholder]").length > 0, ''Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.'');'
|
||||
- text: Set the value of your placeholder attribute to "cat photo URL".
|
||||
testString: 'assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi), ''Set the value of your placeholder attribute to "cat photo URL".'');'
|
||||
- text: The finished <code>input</code> element should have valid syntax.
|
||||
testString: 'assert($("input[type=text]").length > 0 && code.match(/<input((\s+\w+(\s*=\s*(?:".*?"|''.*?''|[\^''">\s]+))?)+\s*|\s*)\/?>/gi), ''The finished <code>input</code> element should have valid syntax.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
<input type="text">
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,82 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedd08835
|
||||
title: Check Radio Buttons and Checkboxes by Default
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cWk3Qh6'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can set a checkbox or radio button to be checked by default using the <code>checked</code> attribute.
|
||||
To do this, just add the word "checked" to the inside of an input element. For example:
|
||||
<code><input type="radio" name="test-name" checked></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Set the first of your <code>radio buttons</code> and the first of your <code>checkboxes</code> to both be checked by default.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your first radio button on your form should be checked by default.
|
||||
testString: 'assert($(''input[type="radio"]'').prop("checked"), ''Your first radio button on your form should be checked by default.'');'
|
||||
- text: Your first checkbox on your form should be checked by default.
|
||||
testString: 'assert($(''input[type="checkbox"]'').prop("checked"), ''Your first checkbox on your form should be checked by default.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
<form action="/submit-cat-photo">
|
||||
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
|
||||
<label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
|
||||
<label><input type="checkbox" name="personality"> Loving</label>
|
||||
<label><input type="checkbox" name="personality"> Lazy</label>
|
||||
<label><input type="checkbox" name="personality"> Energetic</label><br>
|
||||
<input type="text" placeholder="cat photo URL" required>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,66 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08804
|
||||
title: Comment out HTML
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cGyGbca'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Remember that in order to start a comment, you need to use <code><!--</code> and to end a comment, you need to use <code>--></code>
|
||||
Here you'll need to end the comment before your <code>h2</code> element begins.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Comment out your <code>h1</code> element and your <code>p</code> element, but not your <code>h2</code> element.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Comment out your <code>h1</code> element so that it is not visible on your page.
|
||||
testString: 'assert(($("h1").length === 0), ''Comment out your <code>h1</code> element so that it is not visible on your page.'');'
|
||||
- text: Leave your <code>h2</code> element uncommented so that it is visible on your page.
|
||||
testString: 'assert(($("h2").length > 0), ''Leave your <code>h2</code> element uncommented so that it is visible on your page.'');'
|
||||
- text: Comment out your <code>p</code> element so that it is not visible on your page.
|
||||
testString: 'assert(($("p").length === 0), ''Comment out your <code>p</code> element so that it is not visible on your page.'');'
|
||||
- text: 'Be sure to close each of your comments with <code>--></code>.'
|
||||
testString: 'assert(code.match(/[^fc]-->/g).length > 1, ''Be sure to close each of your comments with <code>--></code>.'');'
|
||||
- text: Do not change the order of the <code>h1</code> <code>h2</code> or <code>p</code> in the code.
|
||||
testString: 'assert((code.match(/<([a-z0-9]){1,2}>/g)[0]==="<h1>" && code.match(/<([a-z0-9]){1,2}>/g)[1]==="<h2>" && code.match(/<([a-z0-9]){1,2}>/g)[2]==="<p>") , ''Do not change the order of the <code>h1</code> <code>h2</code> or <code>p</code> in the code.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<!--
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<h2>CatPhotoApp</h2>
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
-->
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,69 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08827
|
||||
title: Create a Bulleted Unordered List
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cDKVPuv'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
HTML has a special element for creating <code>unordered lists</code>, or bullet point style lists.
|
||||
Unordered lists start with an opening <code><ul></code> element, followed by any number of <code><li></code> elements. Finally, unordered lists close with a <code></ul></code>
|
||||
For example:
|
||||
<blockquote><ul><br> <li>milk</li><br> <li>cheese</li><br></ul></blockquote>
|
||||
would create a bullet point style list of "milk" and "cheese".
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Remove the last two <code>p</code> elements and create an unordered list of three things that cats love at the bottom of the page.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Create a <code>ul</code> element.
|
||||
testString: 'assert($("ul").length > 0, ''Create a <code>ul</code> element.'');'
|
||||
- text: You should have three <code>li</code> elements within your <code>ul</code> element.
|
||||
testString: 'assert($("ul li").length > 2, ''You should have three <code>li</code> elements within your <code>ul</code> element.'');'
|
||||
- text: Make sure your <code>ul</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/ul>/gi) && code.match(/<ul/gi) && code.match(/<\/ul>/gi).length === code.match(/<ul/gi).length, ''Make sure your <code>ul</code> element has a closing tag.'');'
|
||||
- text: Make sure your <code>li</code> elements have closing tags.
|
||||
testString: 'assert(code.match(/<\/li>/gi) && code.match(/<li[\s>]/gi) && code.match(/<\/li>/gi).length === code.match(/<li[\s>]/gi).length, ''Make sure your <code>li</code> elements have closing tags.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,76 @@
|
||||
---
|
||||
id: bad87fee1348bd9aede08830
|
||||
title: Create a Form Element
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cmQ3Kfa'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can build web forms that actually submit data to a server using nothing more than pure HTML. You can do this by specifying an action on your <code>form</code> element.
|
||||
For example:
|
||||
<code><form action="/url-where-you-want-to-submit-form-data"></form></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Nest your text field inside a <code>form</code> element, and add the <code>action="/submit-cat-photo"</code> attribute to the form element.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Nest your text input element within a <code>form</code> element.
|
||||
testString: 'assert($("form") && $("form").children("input") && $("form").children("input").length > 0, ''Nest your text input element within a <code>form</code> element.'');'
|
||||
- text: Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code>
|
||||
testString: 'assert($("form").attr("action") === "/submit-cat-photo", ''Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code>'');'
|
||||
- text: Make sure your <code>form</code> element has well-formed open and close tags.
|
||||
testString: 'assert(code.match(/<\/form>/g) && code.match(/<form [^<]*>/g) && code.match(/<\/form>/g).length === code.match(/<form [^<]*>/g).length, ''Make sure your <code>form</code> element has well-formed open and close tags.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
<input type="text" placeholder="cat photo URL">
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,87 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08835
|
||||
title: Create a Set of Checkboxes
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cqrkJsp'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Forms commonly use <code>checkboxes</code> for questions that may have more than one answer.
|
||||
Checkboxes are a type of <code>input</code>
|
||||
Each of your checkboxes can be nested within its own <code>label</code> element. By wrapping an <code>input</code> element inside of a <code>label</code> element it will automatically associate the checkbox input with the label element surrounding it.
|
||||
All related checkbox inputs should have the same <code>name</code> attribute.
|
||||
It is considered best practice to explicitly define the relationship between a checkbox <code>input</code> and its corresponding <code>label</code> by setting the <code>for</code> attribute on the <code>label</code> element to match the <code>id</code> attribute of the associated <code>input</code> element.
|
||||
Here's an example of a checkbox:
|
||||
<code><label for="loving"><input id="loving" type="checkbox" name="personality"> Loving</label></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add to your form a set of three checkboxes. Each checkbox should be nested within its own <code>label</code> element. All three should share the <code>name</code> attribute of <code>personality</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your page should have three checkbox elements.
|
||||
testString: 'assert($(''input[type="checkbox"]'').length > 2, ''Your page should have three checkbox elements.'');'
|
||||
- text: Each of your three checkbox elements should be nested in its own <code>label</code> element.
|
||||
testString: 'assert($(''label > input[type="checkbox"]:only-child'').length > 2, ''Each of your three checkbox elements should be nested in its own <code>label</code> element.'');'
|
||||
- text: Make sure each of your <code>label</code> elements has a closing tag.
|
||||
testString: 'assert(code.match(/<\/label>/g) && code.match(/<label/g) && code.match(/<\/label>/g).length === code.match(/<label/g).length, ''Make sure each of your <code>label</code> elements has a closing tag.'');'
|
||||
- text: Give your checkboxes the <code>name</code> attribute of <code>personality</code>.
|
||||
testString: 'assert($(''label > input[type="checkbox"]'').filter("[name=''personality'']").length > 2, ''Give your checkboxes the <code>name</code> attribute of <code>personality</code>.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
<form action="/submit-cat-photo">
|
||||
<label for="indoor"><input id="indoor" type="radio" name="indoor-outdoor"> Indoor</label>
|
||||
<label for="outdoor"><input id="outdoor" type="radio" name="indoor-outdoor"> Outdoor</label><br>
|
||||
<input type="text" placeholder="cat photo URL" required>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,92 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08834
|
||||
title: Create a Set of Radio Buttons
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cNWKvuR'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can use <code>radio buttons</code> for questions where you want the user to only give you one answer out of multiple options.
|
||||
Radio buttons are a type of <code>input</code>.
|
||||
Each of your radio buttons can be nested within its own <code>label</code> element. By wrapping an <code>input</code> element inside of a <code>label</code> element it will automatically associate the radio button input with the label element surrounding it.
|
||||
All related radio buttons should have the same <code>name</code> attribute to create a radio button group. By creating a radio group, selecting any single radio button will automatically deselect the other buttons within the same group ensuring only one answer is provided by the user.
|
||||
Here's an example of a radio button:
|
||||
<blockquote><label> <br> <input type="radio" name="indoor-outdoor">Indoor <br></label></blockquote>
|
||||
It is considered best practice to set a <code>for</code> attribute on the <code>label</code> element, with a value that matches the value of the <code>id</code> attribute of the <code>input</code> element. This allows assistive technologies to create a linked relationship between the label and the child <code>input</code> element. For example:
|
||||
<blockquote><label for="indoor"> <br> <input id="indoor" type="radio" name="indoor-outdoor">Indoor <br></label></blockquote>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add a pair of radio buttons to your form, each nested in its own label element. One should have the option of <code>indoor</code> and the other should have the option of <code>outdoor</code>. Both should share the <code>name</code> attribute of <code>indoor-outdoor</code> to create a radio group.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your page should have two radio button elements.
|
||||
testString: 'assert($(''input[type="radio"]'').length > 1, ''Your page should have two radio button elements.'');'
|
||||
- text: Give your radio buttons the <code>name</code> attribute of <code>indoor-outdoor</code>.
|
||||
testString: 'assert($(''label > input[type="radio"]'').filter("[name=''indoor-outdoor'']").length > 1, ''Give your radio buttons the <code>name</code> attribute of <code>indoor-outdoor</code>.'');'
|
||||
- text: Each of your two radio button elements should be nested in its own <code>label</code> element.
|
||||
testString: 'assert($(''label > input[type="radio"]:only-child'').length > 1, ''Each of your two radio button elements should be nested in its own <code>label</code> element.'');'
|
||||
- text: Make sure each of your <code>label</code> elements has a closing tag.
|
||||
testString: 'assert((code.match(/<\/label>/g) && code.match(/<label/g) && code.match(/<\/label>/g).length === code.match(/<label/g).length), ''Make sure each of your <code>label</code> elements has a closing tag.'');'
|
||||
- text: One of your radio buttons should have the label <code>indoor</code>.
|
||||
testString: 'assert($("label").text().match(/indoor/gi), ''One of your radio buttons should have the label <code>indoor</code>.'');'
|
||||
- text: One of your radio buttons should have the label <code>outdoor</code>.
|
||||
testString: 'assert($("label").text().match(/outdoor/gi), ''One of your radio buttons should have the label <code>outdoor</code>.'');'
|
||||
- text: Each of your radio button elements should be added within the <code>form</code> tag.
|
||||
testString: 'assert($("label").parent().get(0).tagName.match(''FORM''), ''Each of your radio button elements should be added within the <code>form</code> tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
<form action="/submit-cat-photo">
|
||||
<input type="text" placeholder="cat photo URL" required>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,75 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08829
|
||||
title: Create a Text Field
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/c2EVnf6'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Now let's create a web form.
|
||||
Input elements are a convenient way to get input from your user.
|
||||
You can create a text input like this:
|
||||
<code><input type="text"></code>
|
||||
Note that <code>input</code> elements are self-closing.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Create an <code>input</code> element of type <code>text</code> below your lists.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your app should have an <code>input</code> element of type <code>text</code>.
|
||||
testString: 'assert($("input[type=text]").length > 0, ''Your app should have an <code>input</code> element of type <code>text</code>.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
|
||||
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,85 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08828
|
||||
title: Create an Ordered List
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cQ3B8TM'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
HTML has another special element for creating <code>ordered lists</code>, or numbered lists.
|
||||
Ordered lists start with an opening <code><ol></code> element, followed by any number of <code><li></code> elements. Finally, ordered lists close with a <code></ol></code>
|
||||
For example:
|
||||
<blockquote><ol><br> <li>Garfield</li><br> <li>Sylvester</li><br></ol></blockquote>
|
||||
would create a numbered list of "Garfield" and "Sylvester".
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Create an ordered list of the top 3 things cats hate the most.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 'You should have an ordered list for "Top 3 things cats hate:"'
|
||||
testString: 'assert((/Top 3 things cats hate:/i).test($("ol").prev().text()), ''You should have an ordered list for "Top 3 things cats hate:"'');'
|
||||
- text: 'You should have an unordered list for "Things cats love:"'
|
||||
testString: 'assert((/Things cats love:/i).test($("ul").prev().text()), ''You should have an unordered list for "Things cats love:"'');'
|
||||
- text: You should have only one <code>ul</code> element.
|
||||
testString: 'assert.equal($("ul").length, 1, ''You should have only one <code>ul</code> element.'');'
|
||||
- text: You should have only one <code>ol</code> element.
|
||||
testString: 'assert.equal($("ol").length, 1, ''You should have only one <code>ol</code> element.'');'
|
||||
- text: You should have three <code>li</code> elements within your <code>ul</code> element.
|
||||
testString: 'assert.equal($("ul li").length, 3, ''You should have three <code>li</code> elements within your <code>ul</code> element.'');'
|
||||
- text: You should have three <code>li</code> elements within your <code>ol</code> element.
|
||||
testString: 'assert.equal($("ol li").length, 3, ''You should have three <code>li</code> elements within your <code>ol</code> element.'');'
|
||||
- text: Make sure your <code>ul</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/ul>/g) && code.match(/<\/ul>/g).length === code.match(/<ul>/g).length, ''Make sure your <code>ul</code> element has a closing tag.'');'
|
||||
- text: Make sure your <code>ol</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/ol>/g) && code.match(/<\/ol>/g).length === code.match(/<ol>/g).length, ''Make sure your <code>ol</code> element has a closing tag.'');'
|
||||
- text: Make sure your <code>li</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/li>/g) && code.match(/<li>/g) && code.match(/<\/li>/g).length === code.match(/<li>/g).length, ''Make sure your <code>li</code> element has a closing tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,61 @@
|
||||
---
|
||||
id: 587d78aa367417b2b2512aed
|
||||
title: Declare the Doctype of an HTML Document
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cra98AJ'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The challenges so far have covered specific HTML elements and their uses. However, there are a few elements that give overall structure to your page, and should be included in every HTML document.
|
||||
At the top of your document, you need to tell the browser which version of HTML your page is using. HTML is an evolving language, and is updated regularly. Most major browsers support the latest specification, which is HTML5. However, older web pages may use previous versions of the language.
|
||||
You tell the browser this information by adding the <code><!DOCTYPE ...></code> tag on the first line, where the "<code>...</code>" part is the version of HTML. For HTML5, you use <code><!DOCTYPE html></code>.
|
||||
The <code>!</code> and uppercase <code>DOCTYPE</code> is important, especially for older browsers. The <code>html</code> is not case sensitive.
|
||||
Next, the rest of your HTML code needs to be wrapped in <code>html</code> tags. The opening <code><html></code> goes directly below the <code><!DOCTYPE html></code> line, and the closing <code></html></code> goes at the end of the page.
|
||||
Here's an example of the page structure:
|
||||
<blockquote><!DOCTYPE html><br><html><br> <!-- Your HTML code goes here --><br></html></blockquote>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add a <code>DOCTYPE</code> tag for HTML5 to the top of the blank HTML document in the code editor. Under it, add opening and closing <code>html</code> tags, which wrap around an <code>h1</code> element. The heading can include any text.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should include a <code><!DOCTYPE html></code> tag.
|
||||
testString: 'assert(code.match(/<!DOCTYPE\s+?html\s*?>/gi), ''Your code should include a <code><!DOCTYPE html></code> tag.'');'
|
||||
- text: There should be one <code>html</code> element.
|
||||
testString: 'assert($(''html'').length == 1, ''There should be one <code>html</code> element.'');'
|
||||
- text: The <code>html</code> tags should wrap around one <code>h1</code> element.
|
||||
testString: 'assert(code.match(/<html>\s*?<h1>\s*?.*?\s*?<\/h1>\s*?<\/html>/gi), ''The <code>html</code> tags should wrap around one <code>h1</code> element.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,71 @@
|
||||
---
|
||||
id: 587d78aa367417b2b2512aec
|
||||
title: Define the Head and Body of an HTML Document
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cra9bfP'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can add another level of organization in your HTML document within the <code>html</code> tags with the <code>head</code> and <code>body</code> elements. Any markup with information about your page would go into the <code>head</code> tag. Then any markup with the content of the page (what displays for a user) would go into the <code>body</code> tag.
|
||||
Metadata elements, such as <code>link</code>, <code>meta</code>, <code>title</code>, and <code>style</code>, typically go inside the <code>head</code> element.
|
||||
Here's an example of a page's layout:
|
||||
<blockquote><!DOCTYPE html><br><html><br> <head><br> <!-- metadata elements --><br> </head><br> <body><br> <!-- page contents --><br> </body><br></html></blockquote>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Edit the markup so there's a <code>head</code> and a <code>body</code>. The <code>head</code> element should only include the <code>title</code>, and the <code>body</code> element should only include the <code>h1</code> and <code>p</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: There should be only one <code>head</code> element on the page.
|
||||
testString: 'assert($(''head'').length == 1, ''There should be only one <code>head</code> element on the page.'');'
|
||||
- text: There should be only one <code>body</code> element on the page.
|
||||
testString: 'assert($(''body'').length == 1, ''There should be only one <code>body</code> element on the page.'');'
|
||||
- text: The <code>head</code> element should be a child of the <code>html</code> element.
|
||||
testString: 'assert($(''html'').children(''head'').length == 1, ''The <code>head</code> element should be a child of the <code>html</code> element.'');'
|
||||
- text: The <code>body</code> element should be a child of the <code>html</code> element.
|
||||
testString: 'assert($(''html'').children(''body'').length == 1, ''The <code>body</code> element should be a child of the <code>html</code> element.'');'
|
||||
- text: The <code>head</code> element should wrap around the <code>title</code> element.
|
||||
testString: 'assert(code.match(/<head>\s*?<title>\s*?.*?\s*?<\/title>\s*?<\/head>/gi), ''The <code>head</code> element should wrap around the <code>title</code> element.'');'
|
||||
- text: The <code>body</code> element should wrap around both the <code>h1</code> and <code>p</code> elements.
|
||||
testString: 'assert($(''body'').children(''h1'').length == 1 && $(''body'').children(''p'').length == 1, ''The <code>body</code> element should wrap around both the <code>h1</code> and <code>p</code> elements.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>The best page ever</title>
|
||||
|
||||
<h1>The best page ever</h1>
|
||||
<p>Cat ipsum dolor sit amet, jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed. Go into a room to decide you didn't want to be in there anyway. I like big cats and i can not lie kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Meow i could pee on this if i had the energy for slap owner's face at 5am until human fills food dish yet scamper. Knock dish off table head butt cant eat out of my own dish scratch the furniture. Make meme, make cute face. Sleep in the bathroom sink chase laser but pee in the shoe. Paw at your fat belly licks your face and eat grass, throw it back up kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
|
||||
</html>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,62 @@
|
||||
---
|
||||
id: bad87fed1348bd9aedf08833
|
||||
title: Delete HTML Elements
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/ckK73C9'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Our phone doesn't have much vertical space.
|
||||
Let's remove the unnecessary elements so we can start building our CatPhotoApp.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Delete your <code>h1</code> element so we can simplify our view.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Delete your <code>h1</code> element.
|
||||
testString: 'assert(!code.match(/<h1>/gi) && !code.match(/<\/h1>/gi), ''Delete your <code>h1</code> element.'');'
|
||||
- text: Leave your <code>h2</code> element on the page.
|
||||
testString: 'assert(code.match(/<h2>[\w\W]*<\/h2>/gi), ''Leave your <code>h2</code> element on the page.'');'
|
||||
- text: Leave your <code>p</code> element on the page.
|
||||
testString: 'assert(code.match(/<p>[\w\W]*<\/p>/gi), ''Leave your <code>p</code> element on the page.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<h2>CatPhotoApp</h2>
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
|
||||
```js
|
||||
var code = "<h2>CatPhotoApp</h2><p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>"
|
||||
```
|
||||
|
||||
</section>
|
@ -0,0 +1,57 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08833
|
||||
title: Fill in the Blank with Placeholder Text
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cgR7Dc7'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Web developers traditionally use <code>lorem ipsum text</code> as placeholder text. The 'lorem ipsum' text is randomly scraped from a famous passage by Cicero of Ancient Rome.
|
||||
Lorem ipsum text has been used as placeholder text by typesetters since the 16th century, and this tradition continues on the web.
|
||||
Well, 5 centuries is long enough. Since we're building a CatPhotoApp, let's use something called <code>kitty ipsum text</code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Replace the text inside your <code>p</code> element with the first few words of this kitty ipsum text: <code>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</code>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your <code>p</code> element should contain the first few words of the provided <code>kitty ipsum text</code>.
|
||||
testString: 'assert.isTrue((/Kitty(\s)+ipsum/gi).test($("p").text()), ''Your <code>p</code> element should contain the first few words of the provided <code>kitty ipsum text</code>.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<h2>CatPhotoApp</h2>
|
||||
|
||||
<p>Hello Paragraph</p>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,59 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf0887a
|
||||
title: Headline with the h2 Element
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cE8Gqf3'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Over the next few lessons, we'll build an HTML5 cat photo web app piece-by-piece.
|
||||
The <code>h2</code> element you will be adding in this step will add a level two heading to the web page.
|
||||
This element tells the browser about the structure of your website. <code>h1</code> elements are often used for main headings, while <code>h2</code> elements are generally used for subheadings. There are also <code>h3</code>, <code>h4</code>, <code>h5</code> and <code>h6</code> elements to indicate different levels of subheadings.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add an <code>h2</code> tag that says "CatPhotoApp" to create a second HTML <code>element</code> below your "Hello World" <code>h1</code> element.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Create an <code>h2</code> element.
|
||||
testString: 'assert(($("h2").length > 0), ''Create an <code>h2</code> element.'');'
|
||||
- text: Make sure your <code>h2</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/h2>/g) && code.match(/<\/h2>/g).length === code.match(/<h2>/g).length, ''Make sure your <code>h2</code> element has a closing tag.'');'
|
||||
- text: Your <code>h2</code> element should have the text "CatPhotoApp".
|
||||
testString: 'assert.isTrue((/cat(\s)?photo(\s)?app/gi).test($("h2").text()), ''Your <code>h2</code> element should have the text "CatPhotoApp".'');'
|
||||
- text: Your <code>h1</code> element should have the text "Hello World".
|
||||
testString: 'assert.isTrue((/hello(\s)+world/gi).test($("h1").text()), ''Your <code>h1</code> element should have the text "Hello World".'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h1>Hello World</h1>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,58 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08801
|
||||
title: Inform with the Paragraph Element
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/ceZ7DtN'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
<code>p</code> elements are the preferred element for paragraph text on websites. <code>p</code> is short for "paragraph".
|
||||
You can create a paragraph element like this:
|
||||
<code><p>I'm a p tag!</p></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Create a <code>p</code> element below your <code>h2</code> element, and give it the text "Hello Paragraph".
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Create a <code>p</code> element.
|
||||
testString: 'assert(($("p").length > 0), ''Create a <code>p</code> element.'');'
|
||||
- text: Your <code>p</code> element should have the text "Hello Paragraph".
|
||||
testString: 'assert.isTrue((/hello(\s)+paragraph/gi).test($("p").text()), ''Your <code>p</code> element should have the text "Hello Paragraph".'');'
|
||||
- text: Make sure your <code>p</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, ''Make sure your <code>p</code> element has a closing tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h1>Hello World</h1>
|
||||
<h2>CatPhotoApp</h2>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,69 @@
|
||||
---
|
||||
id: bad87fee1348bd9aecf08801
|
||||
title: Introduction to HTML5 Elements
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/c4Ep9Am'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
HTML5 introduces more descriptive HTML tags. These include <code>header</code>, <code>footer</code>, <code>nav</code>, <code>video</code>, <code>article</code>, <code>section</code> and others.
|
||||
These tags make your HTML easier to read, and also help with Search Engine Optimization (SEO) and accessibility.
|
||||
The <code>main</code> HTML5 tag helps search engines and other developers find the main content of your page.
|
||||
<strong>Note</strong><br>Many of the new HTML5 tags and their benefits are covered in the Applied Accessibility section.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Create a second <code>p</code> element after the existing <code>p</code> element with the following kitty ipsum text: <code>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</code>
|
||||
Wrap the paragraphs with an opening and closing <code>main</code> tag.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: You need 2 <code>p</code> elements with Kitty Ipsum text.
|
||||
testString: 'assert($("p").length > 1, ''You need 2 <code>p</code> elements with Kitty Ipsum text.'');'
|
||||
- text: Make sure each of your <code>p</code> elements has a closing tag.
|
||||
testString: 'assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, ''Make sure each of your <code>p</code> elements has a closing tag.'');'
|
||||
- text: Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>.
|
||||
testString: 'assert.isTrue((/Purr\s+jump\s+eat/gi).test($("p").text()), ''Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>.'');'
|
||||
- text: Your code should have one <code>main</code> element.
|
||||
testString: 'assert($(''main'').length === 1, ''Your code should have one <code>main</code> element.'');'
|
||||
- text: The <code>main</code> element should have two paragraph elements as children.
|
||||
testString: 'assert($("main").children("p").length === 2, ''The <code>main</code> element should have two paragraph elements as children.'');'
|
||||
- text: The opening <code>main</code> tag should come before the first paragraph tag.
|
||||
testString: 'assert(code.match(/<main>\s*?<p>/g), ''The opening <code>main</code> tag should come before the first paragraph tag.'');'
|
||||
- text: The closing <code>main</code> tag should come after the second closing paragraph tag.
|
||||
testString: 'assert(code.match(/<\/p>\s*?<\/main>/g), ''The closing <code>main</code> tag should come after the second closing paragraph tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,67 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08816
|
||||
title: Link to External Pages with Anchor Elements
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/c8EkncB'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can use <code>anchor</code> elements to link to content outside of your web page.
|
||||
<code>anchor</code> elements need a destination web address called an <code>href</code> attribute. They also need anchor text. Here's an example:
|
||||
<code><a href="https://freecodecamp.org">this links to freecodecamp.org</a></code>
|
||||
Then your browser will display the text <strong>"this links to freecodecamp.org"</strong> as a link you can click. And that link will take you to the web address <strong>https://www.freecodecamp.org</strong>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Create an <code>a</code> element that links to <code>http://freecatphotoapp.com</code> and has "cat photos" as its <code>anchor text</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your <code>a</code> element should have the <code>anchor text</code> of "cat photos".
|
||||
testString: 'assert((/cat photos/gi).test($("a").text()), ''Your <code>a</code> element should have the <code>anchor text</code> of "cat photos".'');'
|
||||
- text: 'You need an <code>a</code> element that links to <code>http://freecatphotoapp<wbr>.com</code>'
|
||||
testString: 'assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")), ''You need an <code>a</code> element that links to <code>http://freecatphotoapp<wbr>.com</code>'');'
|
||||
- text: Make sure your <code>a</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, ''Make sure your <code>a</code> element has a closing tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
|
||||
|
||||
|
||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,81 @@
|
||||
---
|
||||
id: bad88fee1348bd9aedf08816
|
||||
title: Link to Internal Sections of a Page with Anchor Elements
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cyrDRUL'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Anchor elements can also be used to create internal links to jump to different sections within a webpage.
|
||||
To create an internal link, you assign a link's <code>href</code> attribute to a hash symbol <code>#</code> plus the value of the <code>id</code> attribute for the element that you want to internally link to, usually further down the page. You then need to add the same <code>id</code> attribute to the element you are linking to. An <code>id</code> is an attribute that uniquely describes an element.
|
||||
Below is an example of an internal anchor link and its target element:
|
||||
<blockquote><a href="#contacts-header">Contacts</a><br>...<br><h2 id="contacts-header">Contacts</h2></blockquote>
|
||||
When users click the Contacts link, they'll be taken to the section of the webpage with the <b>Contacts</b> header element.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Change your external link to an internal link by changing the <code>href</code> attribute to "#footer" and the text from "cat photos" to "Jump to Bottom".
|
||||
Remove the <code>target="_blank"</code> attribute from the anchor tag since this causes the linked document to open in a new window tab.
|
||||
Then add an <code>id</code> attribute with a value of "footer" to the <code><footer></code> element at the bottom of the page.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: There should be only one anchor tag on your page.
|
||||
testString: 'assert($(''a'').length == 1, ''There should be only one anchor tag on your page.'');'
|
||||
- text: There should be only one <code>footer</code> tag on your page.
|
||||
testString: 'assert($(''footer'').length == 1, ''There should be only one <code>footer</code> tag on your page.'');'
|
||||
- text: 'The <code>a</code> tag should have an <code>href</code> attribute set to "#footer".'
|
||||
testString: 'assert($(''a'').eq(0).attr(''href'') == "#footer", ''The <code>a</code> tag should have an <code>href</code> attribute set to "#footer".'');'
|
||||
- text: The <code>a</code> tag should not have a <code>target</code> attribute
|
||||
testString: 'assert(typeof $(''a'').eq(0).attr(''target'') == typeof undefined || $(''a'').eq(0).attr(''target'') == true, ''The <code>a</code> tag should not have a <code>target</code> attribute'');'
|
||||
- text: The <code>a</code> text should be "Jump to Bottom".
|
||||
testString: 'assert($(''a'').eq(0).text().match(/Jump to Bottom/gi), ''The <code>a</code> text should be "Jump to Bottom".'');'
|
||||
- text: The <code>footer</code> tag should have an <code>id</code> attribute set to "footer".
|
||||
testString: 'assert($(''footer'').eq(0).attr(''id'') == "footer", ''The <code>footer</code> tag should have an <code>id</code> attribute set to "footer".'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
|
||||
<a href="http://freecatphotoapp.com" target="_blank">cat photos</a>
|
||||
|
||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched. Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched. Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
<p>Meowwww loved it, hated it, loved it, hated it yet spill litter box, scratch at owner, destroy all furniture, especially couch or lay on arms while you're using the keyboard. Missing until dinner time toy mouse squeak roll over. With tail in the air lounge in doorway. Man running from cops stops to pet cats, goes to jail.</p>
|
||||
<p>Intently stare at the same spot poop in the plant pot but kitten is playing with dead mouse. Get video posted to internet for chasing red dot leave fur on owners clothes meow to be let out and mesmerizing birds leave fur on owners clothes or favor packaging over toy so purr for no reason. Meow to be let out play time intently sniff hand run outside as soon as door open yet destroy couch.</p>
|
||||
|
||||
</main>
|
||||
|
||||
<footer>Copyright Cat Photo App</footer>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,61 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08817
|
||||
title: Make Dead Links Using the Hash Symbol
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cMdkytL'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Sometimes you want to add <code>a</code> elements to your website before you know where they will link.
|
||||
This is also handy when you're changing the behavior of a link using <code>JavaScript</code>, which we'll learn about later.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
The current value of the <code>href</code> attribute is a link that points to "http://freecatphotoapp.com". Replace the <code>href</code> attribute value with a <code>#</code>, also known as a hash symbol, to create a dead link.
|
||||
For example: <code>href="#"</code>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 'Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to "#".'
|
||||
testString: 'assert($("a").attr("href") === "#", ''Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to "#".'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="http://freecatphotoapp.com" target="_blank">cat photos</a>.</p>
|
||||
|
||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,122 @@
|
||||
{
|
||||
"name": "Basic HTML and HTML5",
|
||||
"dashedName": "basic-html-and-html5",
|
||||
"order": 0,
|
||||
"time": "5 hours",
|
||||
"template": "",
|
||||
"required": [],
|
||||
"superBlock": "responsive-web-design",
|
||||
"superOrder": 1,
|
||||
"challengeOrder": [
|
||||
[
|
||||
"bd7123c8c441eddfaeb5bdef",
|
||||
"Say Hello to HTML Elements"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf0887a",
|
||||
"Headline with the h2 Element"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08801",
|
||||
"Inform with the Paragraph Element"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08833",
|
||||
"Fill in the Blank with Placeholder Text"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08802",
|
||||
"Uncomment HTML"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08804",
|
||||
"Comment out HTML"
|
||||
],
|
||||
[
|
||||
"bad87fed1348bd9aedf08833",
|
||||
"Delete HTML Elements"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aecf08801",
|
||||
"Introduction to HTML5 Elements"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08812",
|
||||
"Add Images to Your Website"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08816",
|
||||
"Link to External Pages with Anchor Elements"
|
||||
],
|
||||
[
|
||||
"bad88fee1348bd9aedf08816",
|
||||
"Link to Internal Sections of a Page with Anchor Elements"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aede08817",
|
||||
"Nest an Anchor Element within a Paragraph"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08817",
|
||||
"Make Dead Links Using the Hash Symbol"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08820",
|
||||
"Turn an Image into a Link"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08827",
|
||||
"Create a Bulleted Unordered List"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08828",
|
||||
"Create an Ordered List"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08829",
|
||||
"Create a Text Field"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08830",
|
||||
"Add Placeholder Text to a Text Field"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aede08830",
|
||||
"Create a Form Element"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedd08830",
|
||||
"Add a Submit Button to a Form"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedc08830",
|
||||
"Use HTML5 to Require a Field"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08834",
|
||||
"Create a Set of Radio Buttons"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedf08835",
|
||||
"Create a Set of Checkboxes"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aedd08835",
|
||||
"Check Radio Buttons and Checkboxes by Default"
|
||||
],
|
||||
[
|
||||
"bad87fee1348bd9aede08835",
|
||||
"Nest Many Elements within a Single div Element"
|
||||
],
|
||||
[
|
||||
"587d78aa367417b2b2512aed",
|
||||
"Declare the Doctype of an HTML Document"
|
||||
],
|
||||
[
|
||||
"587d78aa367417b2b2512aec",
|
||||
"Define the Head and Body of an HTML Document"
|
||||
]
|
||||
],
|
||||
"helpRoom": "Help",
|
||||
"fileName": "01-responsive-web-design/basic-html-and-html5.json"
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
---
|
||||
id: bad87fee1348bd9aede08817
|
||||
title: Nest an Anchor Element within a Paragraph
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cb6k8Cb'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can nest links within other text elements.
|
||||
<blockquote><p><br> Here's a <a target="_blank" href="http://freecodecamp.org"> link to freecodecamp.org</a> for you to follow.<br></p></blockquote>
|
||||
Let's break down the example:
|
||||
Normal text is wrapped in the <code>p</code> element:<br> <code><p> Here's a ... for you to follow. </p></code>
|
||||
Next is the <code>anchor</code> element <code><a></code> (which requires a closing tag <code></a></code>):<br> <code><a> ... </a></code>
|
||||
<code>target</code> is an anchor tag attribute that specifies where to open the link and the value <code>"_blank"</code> specifies to open the link in a new tab
|
||||
<code>href</code> is an anchor tag attribute that contains the URL address of the link:<br> <code><a href="http://freecodecamp.org"> ... </a></code>
|
||||
The text, <strong>"link to freecodecamp.org"</strong>, within the anchor element called <code>anchor text</code>, will display a link to click:<br> <code><a href=" ... ">link to freecodecamp.org</a></code>
|
||||
The final output of the example will look like this:<br><p>Here's a <a target="_blank" href="http://freecodecamp.org"> link to freecodecamp.org</a> for you to follow.</p>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Now nest your existing <code>a</code> element within a new <code>p</code> element (just after the existing <code>main</code> element). The new paragraph should have text that says "View more cat photos", where "cat photos" is a link, and the rest of the text is plain text.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 'You need an <code>a</code> element that links to "http://freecatphotoapp.com".'
|
||||
testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0), ''You need an <code>a</code> element that links to "http://freecatphotoapp.com".'');'
|
||||
- text: Your <code>a</code> element should have the anchor text of "cat photos"
|
||||
testString: 'assert($("a").text().match(/cat\sphotos/gi), ''Your <code>a</code> element should have the anchor text of "cat photos"'');'
|
||||
- text: Create a new <code>p</code> element around your <code>a</code> element. There should be at least 3 total <code>p</code> tags in your HTML code.
|
||||
testString: 'assert($("p") && $("p").length > 2, ''Create a new <code>p</code> element around your <code>a</code> element. There should be at least 3 total <code>p</code> tags in your HTML code.'');'
|
||||
- text: Your <code>a</code> element should be nested within your new <code>p</code> element.
|
||||
testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")), ''Your <code>a</code> element should be nested within your new <code>p</code> element.'');'
|
||||
- text: Your <code>p</code> element should have the text "View more " (with a space after it).
|
||||
testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)), ''Your <code>p</code> element should have the text "View more " (with a space after it).'');'
|
||||
- text: Your <code>a</code> element should <em>not</em> have the text "View more".
|
||||
testString: 'assert(!$("a").text().match(/View\smore/gi), ''Your <code>a</code> element should <em>not</em> have the text "View more".'');'
|
||||
- text: Make sure each of your <code>p</code> elements has a closing tag.
|
||||
testString: 'assert(code.match(/<\/p>/g) && code.match(/<p/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, ''Make sure each of your <code>p</code> elements has a closing tag.'');'
|
||||
- text: Make sure each of your <code>a</code> elements has a closing tag.
|
||||
testString: 'assert(code.match(/<\/a>/g) && code.match(/<a/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, ''Make sure each of your <code>a</code> elements has a closing tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
|
||||
<a href="http://freecatphotoapp.com" target="_blank">cat photos</a>
|
||||
|
||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,88 @@
|
||||
---
|
||||
id: bad87fee1348bd9aede08835
|
||||
title: Nest Many Elements within a Single div Element
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cNW4kC3'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The <code>div</code> element, also known as a division element, is a general purpose container for other elements.
|
||||
The <code>div</code> element is probably the most commonly used HTML element of all.
|
||||
Just like any other non-self-closing element, you can open a <code>div</code> element with <code><div></code> and close it on another line with <code></div></code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Nest your "Things cats love" and "Things cats hate" lists all within a single <code>div</code> element.
|
||||
Hint: Try putting your opening <code>div</code> tag above your "Things cats love" <code>p</code> element and your closing <code>div</code> tag after your closing <code>ol</code> tag so that both of your lists are within one <code>div</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Nest your <code>p</code> elements inside your <code>div</code> element.
|
||||
testString: 'assert($("div").children("p").length > 1, ''Nest your <code>p</code> elements inside your <code>div</code> element.'');'
|
||||
- text: Nest your <code>ul</code> element inside your <code>div</code> element.
|
||||
testString: 'assert($("div").children("ul").length > 0, ''Nest your <code>ul</code> element inside your <code>div</code> element.'');'
|
||||
- text: Nest your <code>ol</code> element inside your <code>div</code> element.
|
||||
testString: 'assert($("div").children("ol").length > 0, ''Nest your <code>ol</code> element inside your <code>div</code> element.'');'
|
||||
- text: Make sure your <code>div</code> element has a closing tag.
|
||||
testString: 'assert(code.match(/<\/div>/g) && code.match(/<\/div>/g).length === code.match(/<div>/g).length, ''Make sure your <code>div</code> element has a closing tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
|
||||
<form action="/submit-cat-photo">
|
||||
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
|
||||
<label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
|
||||
<label><input type="checkbox" name="personality" checked> Loving</label>
|
||||
<label><input type="checkbox" name="personality"> Lazy</label>
|
||||
<label><input type="checkbox" name="personality"> Energetic</label><br>
|
||||
<input type="text" placeholder="cat photo URL" required>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,60 @@
|
||||
---
|
||||
id: bd7123c8c441eddfaeb5bdef
|
||||
title: Say Hello to HTML Elements
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cE8Gpt2'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Welcome to freeCodeCamp's HTML coding challenges. These will walk you through web development step-by-step.
|
||||
First, you'll start by building a simple web page using HTML. You can edit <code>code</code> in your <code>code editor</code>, which is embedded into this web page.
|
||||
Do you see the code in your code editor that says <code><h1>Hello</h1></code>? That's an HTML <code>element</code>.
|
||||
Most HTML elements have an <code>opening tag</code> and a <code>closing tag</code>.
|
||||
Opening tags look like this:
|
||||
<code><h1></code>
|
||||
Closing tags look like this:
|
||||
<code></h1></code>
|
||||
The only difference between opening and closing tags is the forward slash after the opening bracket of a closing tag.
|
||||
Each challenge has tests you can run at any time by clicking the "Run tests" button. When you pass all tests, you'll be prompted to submit your solution and go to the next coding challenge.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
To pass the test on this challenge, change your <code>h1</code> element's text to say "Hello World".
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your <code>h1</code> element should have the text "Hello World".
|
||||
testString: 'assert.isTrue((/hello(\s)+world/gi).test($(''h1'').text()), ''Your <code>h1</code> element should have the text "Hello World".'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h1>Hello</h1>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,67 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08820
|
||||
title: Turn an Image into a Link
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cRdBnUr'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can make elements into links by nesting them within an <code>a</code> element.
|
||||
Nest your image within an <code>a</code> element. Here's an example:
|
||||
<code><a href="#"><img src="https://bit.ly/fcc-running-cats" alt="Three kittens running towards the camera."></a></code>
|
||||
Remember to use <code>#</code> as your <code>a</code> element's <code>href</code> property in order to turn it into a dead link.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Place the existing image element within an anchor element.
|
||||
Once you've done this, hover over your image with your cursor. Your cursor's normal pointer should become the link clicking pointer. The photo is now a link.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Nest the existing <code>img</code> element within an <code>a</code> element.
|
||||
testString: 'assert($("a").children("img").length > 0, ''Nest the existing <code>img</code> element within an <code>a</code> element.'');'
|
||||
- text: 'Your <code>a</code> element should be a dead link with a <code>href</code> attribute set to <code>#</code>.'
|
||||
testString: 'assert(new RegExp("#").test($("a").children("img").parent().attr("href")), ''Your <code>a</code> element should be a dead link with a <code>href</code> attribute set to <code>#</code>.'');'
|
||||
- text: Make sure each of your <code>a</code> elements has a closing tag.
|
||||
testString: 'assert(code.match(/<\/a>/g) && code.match(/<a/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, ''Make sure each of your <code>a</code> elements has a closing tag.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,65 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedf08802
|
||||
title: Uncomment HTML
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cBmG9T7'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Commenting is a way that you can leave comments for other developers within your code without affecting the resulting output that is displayed to the end user.
|
||||
Commenting is also a convenient way to make code inactive without having to delete it entirely.
|
||||
Comments in HTML starts with <code><!--</code>, and ends with a <code>--></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Uncomment your <code>h1</code>, <code>h2</code> and <code>p</code> elements.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Make your <code>h1</code> element visible on your page by uncommenting it.
|
||||
testString: 'assert($("h1").length > 0, ''Make your <code>h1</code> element visible on your page by uncommenting it.'');'
|
||||
- text: Make your <code>h2</code> element visible on your page by uncommenting it.
|
||||
testString: 'assert($("h2").length > 0, ''Make your <code>h2</code> element visible on your page by uncommenting it.'');'
|
||||
- text: Make your <code>p</code> element visible on your page by uncommenting it.
|
||||
testString: 'assert($("p").length > 0, ''Make your <code>p</code> element visible on your page by uncommenting it.'');'
|
||||
- text: 'Be sure to delete all trailing comment tags, i.e. <code>--></code>.'
|
||||
testString: 'assert(!/[^fc]-->/gi.test(code.replace(/ *<!--[^fc]*\n/g,'''')), ''Be sure to delete all trailing comment tags, i.e. <code>--></code>.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<!--
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<h2>CatPhotoApp</h2>
|
||||
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
-->
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
@ -0,0 +1,75 @@
|
||||
---
|
||||
id: bad87fee1348bd9aedc08830
|
||||
title: Use HTML5 to Require a Field
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pVMPUv/cMd4EcQ'
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can require specific form fields so that your user will not be able to submit your form until he or she has filled them out.
|
||||
For example, if you wanted to make a text input field required, you can just add the attribute <code>required</code> within your <code>input</code> element, like this: <code><input type="text" required></code>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Make your text <code>input</code> a <code>required</code> field, so that your user can't submit the form without completing this field.
|
||||
Then try to submit the form without inputting any text. See how your HTML5 form notifies you that the field is required?
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your text <code>input</code> element should have the <code>required</code> attribute.
|
||||
testString: 'assert($("input").prop("required"), ''Your text <code>input</code> element should have the <code>required</code> attribute.'');'
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='html-seed'>
|
||||
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
<li>cat nip</li>
|
||||
<li>laser pointers</li>
|
||||
<li>lasagna</li>
|
||||
</ul>
|
||||
<p>Top 3 things cats hate:</p>
|
||||
<ol>
|
||||
<li>flea treatment</li>
|
||||
<li>thunder</li>
|
||||
<li>other cats</li>
|
||||
</ol>
|
||||
<form action="/submit-cat-photo">
|
||||
<input type="text" placeholder="cat photo URL">
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</main>
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
</section>
|
Reference in New Issue
Block a user