Viewers: in countries Watching now:
This course focuses on two elements of web development: accessibility and search engine optimization (SEO), demonstrating why they are important and how they work. Author Morten Rand-Hendriksen also shows how good coding practices and modern web standards can make a site accessible and more visible to search engines and social networks.
A big part of accessibility is adding additional information to the person accessing the site, explaining what they are reading. This is especially true when it comes to menus. For visitors using a visual browser, having a menu heading and skip menu button is pointless, because they can see what's going on. But for non-visual visitors, a menu heading and skip menu button can mean the difference between trying to figure out what all these links are doing together in a big cluster, or listening to a long list of links, or just jumping straight to what matters. Adding and hiding menu headings and skip navigation links is an easy way of making your site more accessible and can be done with a small piece of CSS.
Earlier in this course, we added a menu heading to the Main Menu. Though we can't see it when you use the visual browser, if we turn off our CSS styles, you can see it this Main Menu right here. This is the Main Menu heading. We even have a Main Menu description underneath it. What we want to do now is add headings to our sidebar menu lists and also add skip navigation buttons throughout the site, so that a person visiting the site using a text-to-speech browser can skip the menus if they don't want to listen to every single item.
This is actually a really important tool and it can be used in many different ways. Let's start with the Main Menu. I want to add a simple link at the top that lets you skip directly to the content. First, I will open the index page in my Notepad and find the header-navigation. It's right here. And we already have this h1 for the Main Menu and the description. So what I want to do now is add a div that has a link in it. So I will give this div the class= "skip- button" and then inside the div, I want to add an anchor with some text in it.
Let's say point within my page. I want to target where the actual content starts in the page, and I know that the content starts here on line 44, with this article that has the ID content. So what I want to do is create a link that targets this ID. It's easy to do. I will just type in # which means ID on the current site, and then say content. Now when someone clicks on the link, they will jump directly to the content section on the page.
Because it's a link, I need a title, so I will say title="Skip to content" and then I will put in the actual text that the anchor will wrap around, "Skip to content" and I will end my anchor. When I save this and reload my browser, we now have a link that says Skip to content and if I click on it, we jump down to the content. So this is precisely what we want. When someone is visiting the site using a text-to-speech browser, it should hit that button that says Skip to content before they hit the Menu and after the Menu title.
So they know what the menu is about, then they get the option of skipping the menu, and then they get the menu itself. Now all I have to do is hide this Skip to content button, so it doesn't display for people who are using visual browsers. To do that, I have to go into my style sheet, so I will open the style sheet. And I have already created the function to hide this content earlier, so I just scroll down to my Global styles where I already have the style for the section-heading. So now I can just add on this new class that I have created.
So I will go check what it was called again, it's called Skip button, so I'll copy that, I put a comma after section-heading to say, here's another style this will apply to, and I type punctuation mark, and skip-button, save that, reload the page in the browser, and you will see that the skip button is gone. But if I go back and look at this without styles, you see the Skip to content button is here. Now I can do the same for our sidebar. First I will scroll down to my sidebar and then I can add headings and skip buttons for each of the menus.
So I'll start up here with the first menu. It's one that's called firstWidget, so I will put in an h1, class=" section-heading" so that it hides, and then call it First widget menu. Just to check that everything works, I will go reload my page, and I should not see anything here, but if I go and turn the styles off and scroll down, I should see the menu title, First widget menu. Then I can add the skip link.
In this case, I am just going to scroll up and copy the link I created earlier. So I will just go and grab the entire link, copy it, go down, and paste it in. Now the reason why I'm doing it is because I want to use the same format, but I am going to skip to somewhere else. In this case, I want to skip down to the next widget. And as you can see, the next widget has the id widget1, so I will copy out widget 1 and paste that in instead of content, and then I say Skip to widget 1, Skip to widget 1.
Now when I reload the page and turn off the CSS, you will see we now have the menu header, plus Skip to widget 1, which will automatically jump us down to widget 1. Now that you know how to do it, you can do it for the rest of the sidebar widgets. But I am going to do one final thing and this is just something I like to do, because I think it's kind of funny, and it's also quite useful for people who access my site using a text-to-speech browser. I will go all the way to the bottom of the page. In the footer, and then below the footer, I'll paste in that skip link one more time.
And I will point the anchor to the first div on the entire page, which I know is called id page. Then I will say, "Go back to the top," and then I will write in here, "You have reached bottom. Click here to get back on top." I will save it, and when I reload my page again and turn styles off, you'll see at the very bottom of the page, there is a link that says, "You have reached the bottom. Click here to get back on top!" And when you click it, you jump back to the top of the page and you can read everything all over again.
Accessibility has a lot to do with making things easier for people. Adding navigation headings and skip links might seem unnecessary to a sighted developer, but it's a huge help to those accessing content through a screen reader.
There are currently no FAQs about Improving SEO Using Accessibility Techniques.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.