{"id":76,"date":"2017-04-21T19:13:26","date_gmt":"2017-04-21T19:13:26","guid":{"rendered":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/chapter\/chapter-11-navigation\/"},"modified":"2019-06-13T16:16:32","modified_gmt":"2019-06-13T16:16:32","slug":"chapter-11-navigation","status":"publish","type":"chapter","link":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/chapter\/chapter-11-navigation\/","title":{"raw":"Chapter 11: Navigation","rendered":"Chapter 11: Navigation"},"content":{"raw":"<div class=\"bc-section section\">\n<p class=\"ChapterNumber\">\u00a0A feature found on almost every websites is a navigation system for moving between pages. These are typically menus, where groups of common pages are created to give the site a hierarchical organization. While the approach to visual styling and interaction with menus comes in great variety, most follow a basic principle of using unordered lists of links, and the application of CSS to those lists in order to turn them into the colorful, interactive elements we are accustomed to. While there are drawbacks that we will discuss in <a href=\"https:\/\/milnepublishing.geneseo.edu\/themissinglink\/chapter\/chapter-21-font-and-text-decoration\/#Visually-Impaired-Considerations\"><span class=\"Hyperlink\">Visually Impaired Considerations<\/span><\/a>, alternative approaches can still utilize linked lists to some extent.<\/p>\nSince we created our menu earlier, we already know the contents and structure of our navigation. Our group label, or top-level labels, and the nested &lt;ul&gt;s represent the contents of the list for that menu item.\n\nSome popular approaches to providing a means of navigation are menu bars with drop downs, bread crumbs, and event driven responses. Menu bars are the most frequently utilized element, where hovering or clicking over an item in the menu brings up additional choices related to the main item. Typically referred to as drop down menus, they can be styled to move in any direction. Nesting lists within lists can give us a multi-tier menu that allows us the ability to select from a large number of pages with little effort.\n\nBreadcrumbs are typically depicted as a horizontal delimited list of pages, similar to:\n<ol class=\"Code\"><li class=\"Code\">Home &gt;&gt; Sports &gt;&gt; Football &gt;&gt; Buffalo Bills &gt;&gt; Patriots &gt;&gt; Golf<\/li>\n<\/ol>\nThe breadcrumb does not follow a hierarchical notation, but acts more like a brief history of where you have been on the site, allowing you to skip back several steps at once without using your browser\u2019s back button. These can be helpful in sites with large amounts of content where the user\u2019s experience may not be particularly linear, as they move between topics or sections, like news or reference sites.\n\nEvent-driven navigation is useful in narrowing the user experience to a fixed set of paths. This method will only make certain links available under certain conditions, restricting the options a user has on a particular page to what they are allowed to do, which may be based on a variety of rules such as if they are logged in, previous links or decisions they have made, or if something in the system needs their attention.\n\nThese approaches can be used by themselves, or in combination to provide your user experience.\n<h1>Linking<\/h1>\nLinks in HTML can take two forms, both of which are created with the anchor tag (&lt;a&gt;). They can either point to a resource in another location, or to a location within the document. The former are used far more frequently than the latter, however internal links are coming back into popularity with the rise of infinite scrolling.\n<h2>Absolute, Base, and Relative Path<\/h2>\nThe href attribute of an anchor tag defines the actual location the link will represent. Absolute and relative paths are two reference methods for connecting sites and pages. While both methods can be used when creating links that point to content in our own site, only absolute can be used when pointing to content that is outside of your domain.\n\nAbsolute paths are the entire length of the link required to identify one resource, whether it is a page, image, script, or media file. The <a href=\"http:\/\/www.msn.com\/news\/index.htm\">URL <span class=\"Hyperlink\">http:\/\/www.msn.com\/news\/ind<\/span><\/a><span class=\"Hyperlink\">ex.htm<\/span> tells us we want to go to the index page in the news folder of the msn.com website. If this was our site, and we wanted to go to the index.htm file in the sports folder, we could write <a href=\"http:\/\/www.msn.com\/sports\/index.htm\">it as <span class=\"Hyperlink\">http:\/\/www.msn.com\/sports\/ind<\/span><\/a><span class=\"Hyperlink\">ex.htm<\/span> (absolute) or ..\/sports\/index.htm (relative). The initial .. instructs the browser that our intention is to go back one layer of depth (i.e. \u201cup\u201d one level in folders) and then into the sports folder, which in this example sits in the same parent folder as our news page.\n\nUsing just an initial \/ without .. tells the server that we want to start at the root folder of the server and navigate from there, meaning we start with the base path.\n\nA base path is everything needed to get us to the index page of the root folder of the site. This is typically http:\/\/www.yoursitename.com, and is the part you find missing in the relative path above. The combination of the base path, and relative path, equals your absolute path.\n<h2>Target<\/h2>\nWhile the anchor tag supports several attributes, one of the most important of these is \u201ctarget.\u201d This attribute describes where links will be loaded, like a new tab or the same tab\/browser window we are already using. The attribute can take any of the following values to define that location.\n<p class=\"Caption\"><em><a>Table 2 Anchor Targets<\/a><\/em><\/p>\n\n<table id=\"table-12\" class=\"Table-1\"><colgroup><col \/><col \/><\/colgroup><tbody><tr><th>\n<p class=\"Table-Heading\"><strong>Value<\/strong><\/p>\n<\/th>\n<th>\n<p class=\"Table-Heading\"><strong>Description<\/strong><\/p>\n<\/th>\n<\/tr><tr class=\"Row-Column-42\"><td>\n<p class=\"Table-Small\">_blank<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in a new window or tab<\/p>\n<\/td>\n<\/tr><tr><td>\n<p class=\"Table-Small\">_self<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in the same frame as it was clicked (this is default)<\/p>\n<\/td>\n<\/tr><tr class=\"Row-Column-42\"><td>\n<p class=\"Table-Small\">_parent<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in the parent frame<\/p>\n<\/td>\n<\/tr><tr><td>\n<p class=\"Table-Small\">_top<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in the full body of the window<\/p>\n<\/td>\n<\/tr><tr class=\"Row-Column-42\"><td>\n<p class=\"Table-Small\"><em>framename<\/em><\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in a named frame<\/p>\n<\/td>\n<\/tr><\/tbody><\/table><p class=\"Byline\"><a href=\"http:\/\/www.w3schools.com\/jsref\/prop_anchor_target.asp\"><em>From php.net manual, creative commons 3.0 Attribution<\/em><\/a><\/p>\n\n<h2>Within the Page<\/h2>\nWe can add links to a page that move the user around the page itself, which is useful on pages with long content. To do this, we use an anchor tag to define where we want our destination to be. When we create our link, we simply reference the name of our anchor, preceded by a pound sign in place of a traditional URL.\n<table id=\"table-13\" class=\"blank\"><colgroup><col \/><col \/><\/colgroup><tbody><tr><td>\n<ul><li class=\"Code\">Some text here.<\/li>\n<\/ul><ul><li class=\"Code\">&lt;a href=\"#ourDestination\"&gt;Click here to go further down.&lt;\/a&gt;<\/li>\n<\/ul><ul><li class=\"Code\">Some more text.<\/li>\n<\/ul><ul><li class=\"Code\">Even more text!<\/li>\n<\/ul><ul><li class=\"Code\">&lt;a name=\"ourDestination\"&gt;<\/li>\n<\/ul><ul><li class=\"Code\">This is where we want to \"jump\" to.<\/li>\n<\/ul><\/td>\n<td>\n<p class=\"Table-Large\">Some text here.\n<a href=\"#ourDestination\">Click here to go further down.<\/a>\nSome more text.\nEven more text!\n<a id=\"ourDestination\">\nThis is where we want to \u201cjump\u201d to.\n<\/a><\/p><\/td>\n<\/tr><\/tbody><\/table><\/div>","rendered":"<div class=\"bc-section section\">\n<p class=\"ChapterNumber\">\u00a0A feature found on almost every websites is a navigation system for moving between pages. These are typically menus, where groups of common pages are created to give the site a hierarchical organization. While the approach to visual styling and interaction with menus comes in great variety, most follow a basic principle of using unordered lists of links, and the application of CSS to those lists in order to turn them into the colorful, interactive elements we are accustomed to. While there are drawbacks that we will discuss in <a href=\"https:\/\/milnepublishing.geneseo.edu\/themissinglink\/chapter\/chapter-21-font-and-text-decoration\/#Visually-Impaired-Considerations\"><span class=\"Hyperlink\">Visually Impaired Considerations<\/span><\/a>, alternative approaches can still utilize linked lists to some extent.<\/p>\n<p>Since we created our menu earlier, we already know the contents and structure of our navigation. Our group label, or top-level labels, and the nested &lt;ul&gt;s represent the contents of the list for that menu item.<\/p>\n<p>Some popular approaches to providing a means of navigation are menu bars with drop downs, bread crumbs, and event driven responses. Menu bars are the most frequently utilized element, where hovering or clicking over an item in the menu brings up additional choices related to the main item. Typically referred to as drop down menus, they can be styled to move in any direction. Nesting lists within lists can give us a multi-tier menu that allows us the ability to select from a large number of pages with little effort.<\/p>\n<p>Breadcrumbs are typically depicted as a horizontal delimited list of pages, similar to:<\/p>\n<ol class=\"Code\">\n<li class=\"Code\">Home &gt;&gt; Sports &gt;&gt; Football &gt;&gt; Buffalo Bills &gt;&gt; Patriots &gt;&gt; Golf<\/li>\n<\/ol>\n<p>The breadcrumb does not follow a hierarchical notation, but acts more like a brief history of where you have been on the site, allowing you to skip back several steps at once without using your browser\u2019s back button. These can be helpful in sites with large amounts of content where the user\u2019s experience may not be particularly linear, as they move between topics or sections, like news or reference sites.<\/p>\n<p>Event-driven navigation is useful in narrowing the user experience to a fixed set of paths. This method will only make certain links available under certain conditions, restricting the options a user has on a particular page to what they are allowed to do, which may be based on a variety of rules such as if they are logged in, previous links or decisions they have made, or if something in the system needs their attention.<\/p>\n<p>These approaches can be used by themselves, or in combination to provide your user experience.<\/p>\n<h1>Linking<\/h1>\n<p>Links in HTML can take two forms, both of which are created with the anchor tag (&lt;a&gt;). They can either point to a resource in another location, or to a location within the document. The former are used far more frequently than the latter, however internal links are coming back into popularity with the rise of infinite scrolling.<\/p>\n<h2>Absolute, Base, and Relative Path<\/h2>\n<p>The href attribute of an anchor tag defines the actual location the link will represent. Absolute and relative paths are two reference methods for connecting sites and pages. While both methods can be used when creating links that point to content in our own site, only absolute can be used when pointing to content that is outside of your domain.<\/p>\n<p>Absolute paths are the entire length of the link required to identify one resource, whether it is a page, image, script, or media file. The <a href=\"http:\/\/www.msn.com\/news\/index.htm\">URL <span class=\"Hyperlink\">http:\/\/www.msn.com\/news\/ind<\/span><\/a><span class=\"Hyperlink\">ex.htm<\/span> tells us we want to go to the index page in the news folder of the msn.com website. If this was our site, and we wanted to go to the index.htm file in the sports folder, we could write <a href=\"http:\/\/www.msn.com\/sports\/index.htm\">it as <span class=\"Hyperlink\">http:\/\/www.msn.com\/sports\/ind<\/span><\/a><span class=\"Hyperlink\">ex.htm<\/span> (absolute) or ..\/sports\/index.htm (relative). The initial .. instructs the browser that our intention is to go back one layer of depth (i.e. \u201cup\u201d one level in folders) and then into the sports folder, which in this example sits in the same parent folder as our news page.<\/p>\n<p>Using just an initial \/ without .. tells the server that we want to start at the root folder of the server and navigate from there, meaning we start with the base path.<\/p>\n<p>A base path is everything needed to get us to the index page of the root folder of the site. This is typically http:\/\/www.yoursitename.com, and is the part you find missing in the relative path above. The combination of the base path, and relative path, equals your absolute path.<\/p>\n<h2>Target<\/h2>\n<p>While the anchor tag supports several attributes, one of the most important of these is \u201ctarget.\u201d This attribute describes where links will be loaded, like a new tab or the same tab\/browser window we are already using. The attribute can take any of the following values to define that location.<\/p>\n<p class=\"Caption\"><em><a>Table 2 Anchor Targets<\/a><\/em><\/p>\n<table id=\"table-12\" class=\"Table-1\">\n<colgroup>\n<col \/>\n<col \/><\/colgroup>\n<tbody>\n<tr>\n<th>\n<p class=\"Table-Heading\"><strong>Value<\/strong><\/p>\n<\/th>\n<th>\n<p class=\"Table-Heading\"><strong>Description<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr class=\"Row-Column-42\">\n<td>\n<p class=\"Table-Small\">_blank<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in a new window or tab<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p class=\"Table-Small\">_self<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in the same frame as it was clicked (this is default)<\/p>\n<\/td>\n<\/tr>\n<tr class=\"Row-Column-42\">\n<td>\n<p class=\"Table-Small\">_parent<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in the parent frame<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p class=\"Table-Small\">_top<\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in the full body of the window<\/p>\n<\/td>\n<\/tr>\n<tr class=\"Row-Column-42\">\n<td>\n<p class=\"Table-Small\"><em>framename<\/em><\/p>\n<\/td>\n<td>\n<p class=\"Table-Small\">Opens the linked document in a named frame<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"Byline\"><a href=\"http:\/\/www.w3schools.com\/jsref\/prop_anchor_target.asp\"><em>From php.net manual, creative commons 3.0 Attribution<\/em><\/a><\/p>\n<h2>Within the Page<\/h2>\n<p>We can add links to a page that move the user around the page itself, which is useful on pages with long content. To do this, we use an anchor tag to define where we want our destination to be. When we create our link, we simply reference the name of our anchor, preceded by a pound sign in place of a traditional URL.<\/p>\n<table id=\"table-13\" class=\"blank\">\n<colgroup>\n<col \/>\n<col \/><\/colgroup>\n<tbody>\n<tr>\n<td>\n<ul>\n<li class=\"Code\">Some text here.<\/li>\n<\/ul>\n<ul>\n<li class=\"Code\">&lt;a href=&#8221;#ourDestination&#8221;&gt;Click here to go further down.&lt;\/a&gt;<\/li>\n<\/ul>\n<ul>\n<li class=\"Code\">Some more text.<\/li>\n<\/ul>\n<ul>\n<li class=\"Code\">Even more text!<\/li>\n<\/ul>\n<ul>\n<li class=\"Code\">&lt;a name=&#8221;ourDestination&#8221;&gt;<\/li>\n<\/ul>\n<ul>\n<li class=\"Code\">This is where we want to &#8220;jump&#8221; to.<\/li>\n<\/ul>\n<\/td>\n<td>\n<p class=\"Table-Large\">Some text here.<br \/>\n<a href=\"#ourDestination\">Click here to go further down.<\/a><br \/>\nSome more text.<br \/>\nEven more text!<br \/>\n<a id=\"ourDestination\"><br \/>\nThis is where we want to \u201cjump\u201d to.<br \/>\n<\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\t\t\t <section class=\"citations-section\" role=\"contentinfo\">\n\t\t\t <h3>Candela Citations<\/h3>\n\t\t\t\t\t <div>\n\t\t\t\t\t\t <div id=\"citation-list-76\">\n\t\t\t\t\t\t\t <div class=\"licensing\"><div class=\"license-attribution-dropdown-subheading\">CC licensed content, Shared previously<\/div><ul class=\"citation-list\"><li>The Missing Link. <strong>Authored by<\/strong>: Michael Mendez. <strong>Provided by<\/strong>: Open SUNY Textbooks. <strong>Located at<\/strong>: <a target=\"_blank\" href=\"https:\/\/textbooks.opensuny.org\/the-missing-link-an-introduction-to-web-development-and-programming\/\">https:\/\/textbooks.opensuny.org\/the-missing-link-an-introduction-to-web-development-and-programming\/<\/a>. <strong>License<\/strong>: <em><a target=\"_blank\" rel=\"license\" href=\"https:\/\/creativecommons.org\/licenses\/by-nc-sa\/4.0\/\">CC BY-NC-SA: Attribution-NonCommercial-ShareAlike<\/a><\/em><\/li><\/ul><\/div>\n\t\t\t\t\t\t <\/div>\n\t\t\t\t\t <\/div>\n\t\t\t <\/section>","protected":false},"author":311,"menu_order":6,"template":"","meta":{"_candela_citation":"[{\"type\":\"cc\",\"description\":\"The Missing Link\",\"author\":\"Michael Mendez\",\"organization\":\"Open SUNY Textbooks\",\"url\":\"https:\/\/textbooks.opensuny.org\/the-missing-link-an-introduction-to-web-development-and-programming\/\",\"project\":\"\",\"license\":\"cc-by-nc-sa\",\"license_terms\":\"\"}]","CANDELA_OUTCOMES_GUID":"","pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-76","chapter","type-chapter","status-publish","hentry"],"part":62,"_links":{"self":[{"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/pressbooks\/v2\/chapters\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/wp\/v2\/users\/311"}],"version-history":[{"count":1,"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/pressbooks\/v2\/chapters\/76\/revisions"}],"predecessor-version":[{"id":316,"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/pressbooks\/v2\/chapters\/76\/revisions\/316"}],"part":[{"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/pressbooks\/v2\/parts\/62"}],"metadata":[{"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/pressbooks\/v2\/chapters\/76\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/pressbooks\/v2\/chapter-type?post=76"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/wp\/v2\/contributor?post=76"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/suny-the-missing-link-an-introduction-to-web-development-and-programming\/wp-json\/wp\/v2\/license?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}