Addressing
We've discussed URLs and hyperlinks; how to form a URL and how to use the anchor tag to place links in HTML. Here we will build a simple HTML5 page and add some links to it.
We've discussed URLs and hyperlinks; how to form a URL and how to use the anchor tag to place links in HTML. Here we will build a simple HTML5 page and add some links to it.
links. Place any files you create in it.index.html that contains the following content:
In this task you will add links to your favourite websites to the list in the first section of the page.
Inindex.html notice the extlinks element. The ul tags indicate an unordered list, which is rendered as bullets by the browser. Each item in the list is surrounded by li list item tags thus: <li>Example list item.</li>.
li tags to the ul in index.html, each on a new line. You should now have four empty list items.li tags, add an a tag to link to your chosen websites. Each link should use the syntax: <a href="URL">Link Text</a> where URL is the address of the website you want to link to, and Link Text is the text that will appear as the link in the browser.about.html, studies.html and music.html. Keep your filenames lower case (this is good practice for all web resources).links folder.index.html file. In the second section, make a new ul element with three li items inside it.href, for example <a href="about.html">. index.html in your browser and check that your links work.NB: When using a server, you can link to index.html with <a href="/"> but this link won't work if you're opening files from a local filesystem.
target attribute so the site opens in a new window (look up the exact syntax if needed).index.html, add a fragment link back to your list of external websites, e.g. <a href="#extlinks">Back to favourite websites</a>, then test by scrolling away from the list and clicking the link.You now have a basic understanding of links. Try the following for an extra challenge.
about.html, studies.html, and music.html into a subfolder called pages, then update the relative links in index.html.studies.html, link to work from previous weeks.<nav> containing a <ul>; use CSS to display the list horizontally.