interal link lesson - remove obsolete name attribute

pull/18182/head
marigerr 2017-07-23 13:21:29 +02:00
parent e9f141ed44
commit 85cbbc87f5
1 changed files with 20 additions and 16 deletions

View File

@ -759,18 +759,15 @@
"id": "bad88fee1348bd9aedf08816",
"title": "Link to Internal Sections of a Page with Anchor Elements",
"description": [
"In addition to creating external links, anchor elements can also be used to create internal links, which are links that jump to different sections within a webpage.",
"The format is similar to an external link except instead of a URL, you'll use the <code>#</code> and a word to describe the section you want to jump to.",
"Here's an example:",
"<code>&lt;a href=\"#contact\"&gt;Go to contact section&lt;/a&gt;</code>",
"Next, you'll want to create a corresponding anchor link in the HTML where you want the internal link to take users. Instead of using the <code>href</code> attribute, you'll use the <code>name</code> attribute. Here's an example:",
"<blockquote>&lt;h1&gt;Contact&lt;/h1&gt;<br>&lt;a name=\"contact\"&gt;&lt;/a&gt;</blockquote>",
"Now when users click the \"Go to contact section\" link, they'll be taken to the section of the webpage with the anchor that has the <code>name</code> attribute \"contact\".",
"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>&lt;a href=\"#contacts-header\"&gt;Contacts&lt;/a&gt;<br>...<br>&lt;h2 id=\"contacts-header\"&gt;Contacts&lt;/h2&gt;</blockquote>",
"When users click the <u>Contacts</u> link, they'll be taken to the section of the webpage with the <b>Contacts</b> header element.",
"<hr>",
"Change your external link to an internal link by changing the <code>href</code> attribute to \"#bottom\" and the anchor text from \"cat photos\" to \"Jump to Bottom\".",
"Don't forget to remove the <code>target=\"_blank\"</code> attribute since this causes the linked document to open in a new window tab.",
"Then add an anchor link with a <code>name</code> attribute set to \"bottom\" after the last paragraph.",
"<strong>Note</strong><br>Additional kitty ipsum text has been added to the paragraphs to better show the effect of clicking the internal anchor link to jump to the bottom of the page. Also, this change will only apply to this challenge. The next challenge goes back to showing your external link."
"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>&lt;footer&gt;</code> element at the bottom of the page."
],
"challengeSeed": [
"<h2>CatPhotoApp</h2>",
@ -778,17 +775,24 @@
" ",
" <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. \">",
" <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>"
"</main>",
" ",
"<footer>Copyright Cat Photo App</footer>"
],
"tests": [
"assert($('a').length == 2, 'message: There should be only two anchor tags on your page.');",
"assert($('a').eq(0).attr('href') == \"#bottom\", 'message: The first <code>a</code> tag should have an <code>href</code> attribute set to #bottom.');",
"assert($('a').eq(1).attr('name') == \"bottom\", 'message: The second <code>a</code> tag should have a <code>name</code> attribute set to bottom.');"
"assert($('a').length == 1, 'message: There should be only one anchor tag on your page.');",
"assert($('footer').length == 1, 'message: There should be only one <code>footer</code> tag on your page.');",
"assert($('a').eq(0).attr('href') == \"#footer\", 'message: The <code>a</code> tag should have an <code>href</code> attribute set to \"#footer\".');",
"assert(typeof $('a').eq(0).attr('target') == typeof undefined || $('a').eq(0).attr('target') == true, 'message: The <code>a</code> tag should not have a <code>target</code> attribute');",
"assert($('a').eq(0).text().match(/Jump to Bottom/gi), 'message: The <code>a</code> text should be \"Jump to Bottom\".');",
"assert($('footer').eq(0).attr('id') == \"footer\", 'message: The <code>footer</code> tag should have an <code>id</code> attribute set to \"footer\".');"
],
"type": "waypoint",
"challengeType": 0,