Skip to content

Commit 430cac1

Browse files
committed
3 Applied Accessibility - solutions FREECODECAMP
1 parent 72cce99 commit 430cac1

File tree

45 files changed

+854
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+854
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<img src="doingKarateWow.jpeg" alt="cat doing karate">
2+
3+
<!-- Add a Text Alternative to Images for Visually Impaired Accessibility You've likely seen an alt attribute on an img tag in other challenges. alt text describes the image's content and provides a text-alternative
4+
for it. An alt attribute helps in cases where the image fails to load or can't be seen by a user. Search engines also use it to understand what an image contains to include it in search results. Here's an example:
5+
6+
<img src="importantLogo.jpeg" alt="Company logo"> People with visual impairments rely on screen readers to convert web content to an audio interface. They won't get information if it's only presented visually. For images, screen readers can access the
7+
alt attribute and read its contents to deliver key information. Good alt text provides the reader a brief description of the image. You should always include an alt attribute on your image. Per HTML5 specification, this is now considered mandatory. Camper
8+
Cat happens to be both a coding ninja and an actual ninja, who is building a website to share his knowledge. The profile picture he wants to use shows his skills and should be appreciated by all site visitors. Add an alt attribute in the img tag, that
9+
explains Camper Cat is doing karate. (The image src doesn't link to an actual file, so you should see the alt text in the display.) -->
207 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<h1>Deep Thoughts with Master Camper Cat</h1>
2+
<article>
3+
<h2>Defeating your Foe: the Red Dot is Ours!</h2>
4+
<p>To Come...</p>
5+
</article>
6+
7+
<img src="samuraiSwords.jpeg" alt="">
8+
9+
<article>
10+
<h2>Is Chuck Norris a Cat Person?</h2>
11+
<p>To Come...</p>
12+
</article>
13+
14+
<!-- Know When Alt Text Should be Left Blank In the last challenge, you learned that including an alt attribute when using img tags is mandatory. However, sometimes images are grouped with a caption already describing them, or are used for decoration only.
15+
In these cases, alt text may seem redundant or unnecessary. When an image is already explained with text content or does not add meaning to a page, the img still needs an alt attribute, but it can be set to an empty string. Here's an example:
16+
17+
<img src="visualDecoration.jpeg" alt=""> Background images usually fall under the 'decorative' label as well. However, they are typically applied with CSS rules, and therefore not part of the markup screen readers process. Note: For images with a caption,
18+
you may still want to include alt text since it helps search engines catalog the image's content. Camper Cat has coded a skeleton page for the blog part of his website. He's planning to add a visual break between his two articles with a decorative image
19+
of a samurai sword. Add an alt attribute to the img tag and set it to an empty string. (Note that the image src doesn't link to an actual file - don't worry that there are no swords showing in the display.) -->
217 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<h1>How to Become a Ninja</h1>
2+
<main>
3+
<h2>Learn the Art of Moving Stealthily</h2>
4+
<h3>How to Hide in Plain Sight</h3>
5+
<h3>How to Climb a Wall</h3>
6+
7+
<h2>Learn the Art of Battle</h2>
8+
<h3>How to Strengthen your Body</h3>
9+
<h3>How to Fight like a Ninja</h3>
10+
11+
<h2>Learn the Art of Living with Honor</h2>
12+
<h3>How to Breathe Properly</h3>
13+
<h3>How to Simplify your Life</h3>
14+
</main>
15+
16+
<!-- Use Headings to Show Hierarchical Relationships of Content Headings (h1 through h6 elements) are workhorse tags that help provide structure and labeling to your content. Screen readers can be set to read only the headings on a page so the user gets a
17+
summary. This means it is important for the heading tags in your markup to have semantic meaning and relate to each other, not be picked merely for their size values. Semantic meaning means that the tag you use around content indicates the type of information
18+
it contains. If you were writing a paper with an introduction, a body, and a conclusion, it wouldn't make much sense to put the conclusion as a subsection of the body in your outline. It should be its own section. Similarly, the heading tags in a webpage
19+
need to go in order and indicate the hierarchical relationships of your content. Headings with equal (or higher) rank start new implied sections, headings with lower rank start subsections of the previous one. As an example, a page with an h2 element
20+
followed by several subsections labeled with h4 tags would confuse a screen reader user. With six choices, it's tempting to use a tag because it looks better in a browser, but you can use CSS to edit the relative sizing. One final point, each page should
21+
always have one (and only one) h1 element, which is the main subject of your content. This and the other headings are used in part by search engines to understand the topic of the page. Camper Cat wants a page on his site dedicated to becoming a ninja.
22+
Help him fix the headings so his markup gives semantic meaning to the content, and shows the proper parent-child relationships of his sections. Change all the h5 tags to the proper heading level to indicate they are subsections of the h2 ones. Use h3
23+
tags for the purpose. -->
231 KB
Loading
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<header>
2+
<h1>Weapons of the Ninja</h1>
3+
</header>
4+
5+
<main></main>
6+
7+
<footer></footer>
8+
<!-- Jump Straight to the Content Using the main Element HTML5 introduced several new elements that give developers more options while also incorporating accessibility features. These tags include main, header, footer, nav, article, and section, among others.
9+
By default, a browser renders these elements similar to the humble div. However, using them where appropriate gives additional meaning to your markup. The tag name alone can indicate the type of information it contains, which adds semantic meaning to
10+
that content. Assistive technologies can access this information to provide better page summary or navigation options to their users. The main element is used to wrap (you guessed it) the main content, and there should be only one per page. It's meant
11+
to surround the information related to your page's central topic. It's not meant to include items that repeat across pages, like navigation links or banners. The main tag also has an embedded landmark feature that assistive technology can use to navigate
12+
to the main content quickly. If you've ever seen a "Jump to Main Content" link at the top of a page, using the main tag automatically gives assistive devices that functionality. Camper Cat has some big ideas for his ninja weapons page. Help him set up
13+
his markup by adding opening and closing main tags between the header and footer (covered in other challenges). Keep the main tags empty for now. -->
182 KB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h1>Deep Thoughts with Master Camper Cat</h1>
2+
<main>
3+
<article>
4+
<h2>The Garfield Files: Lasagna as Training Fuel?</h2>
5+
<p>The internet is littered with varying opinions on nutritional paradigms, from catnip paleo to hairball cleanses. But let's turn our attention to an often overlooked fitness fuel, and examine the protein-carb-NOM trifecta that is lasagna...</p>
6+
</article>
7+
8+
<img src="samuraiSwords.jpeg" alt="">
9+
10+
<article>
11+
<h2>Defeating your Foe: the Red Dot is Ours!</h2>
12+
<p>Felines the world over have been waging war on the most persistent of foes. This red nemesis combines both cunning stealth and lightning speed. But chin up, fellow fighters, our time for victory may soon be near...</p>
13+
</article>
14+
15+
<img src="samuraiSwords.jpeg" alt="">
16+
17+
<article>
18+
<h2>Is Chuck Norris a Cat Person?</h2>
19+
<p>Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...</p>
20+
</article>
21+
</main>
22+
23+
<!--
24+
Wrap Content in the article Element article is another one of the new HTML5 elements that add semantic meaning to your markup. article is a sectioning element and is used to wrap independent, self-contained content. The tag works well with blog entries,
25+
forum posts, or news articles. Determining whether content can stand alone is usually a judgment call, but you can use a couple of simple tests. Ask yourself if you removed all surrounding context, would that content still make sense? Similarly, for text,
26+
would the content hold up if it were in an RSS feed? Remember that folks using assistive technologies rely on organized, semantically meaningful markup to better understand your work. Note: The section element is also new with HTML5, and has a slightly
27+
different semantic meaning than article. An article is for standalone content, and a section is for grouping thematically related content. They can be used within each other, as needed. For example, if a book is the article, then each chapter is a section.
28+
When there's no relationship between groups of content, then use a div.
29+
30+
<div> - groups content
31+
<section> - groups related content
32+
<article> - groups independent, self-contained content Camper Cat used article tags to wrap the posts on his blog page, but he forgot to use them around the top one. Change the div tag to use an article tag instead. -->
266 KB
Loading

0 commit comments

Comments
 (0)