Creating a Menu and Completing Your Web SiteAt this stage, the pages of your Web site are ready. A page stands on its own, independently. In order for it to be a Web site it must have a menu, which is really a navigation mechanism, to connect and link the pages together. In this chapter you will:
At the end of this chapter your Web pages will look as follows: ![]() A menuSo far you have designed the following pages of your personal Web site: homePage.html, about.html, books.html, links.html and friends.html. Every page stands alone and the time has now come to place them all into the structure of a complete Web site. Every Web site has a structure, that can be seen in the menu (toolbar of links) that is located either at the top or on one side (left or right) of the page. The figure below illustrates the structure of a site with the menu at the top as follows:
Your menu will contain links to the pages on your site: homePage.html, about.html, books.html, links.html and friends.html. You will create a new HTML page that will be named menu.html. It will contain five links (a link to each Web page you have) and will look like this: ![]() Figure 9.1: The menu Creating a menuCreate a new HTML page - menu.html fileCreate a new page named menu.html with links to your Web pages.
Please note that the value of the target attribute of the <a> tag must be _top. This is essential for what you are going to do next. ThinkingClick on the Books link. Please notice that the menu disappears and the books.html page appears instead of it. That's fine, but it is not possible to navigate your Web site if the menu disappears from the screen. So I have an idea. Instead of writing a menu page by the name of menu.html, I will write the menu (links) on each of the pages of the Web site. A great idea! Yes, that's it - the menu should be part of every single page on your personal Web site. Let us suppose (don't actually do anything yet, apart from thinking) that every single page on your Web site has links to every other page on the site. What will happen when you add a new page to your Web site? You will still want every other page on the site to have a link to the new page, right? You will have to go into every individual Web page and add the link - that's a lot of detailed work with a good chance of making a mistake somewhere. So let's think some more (still without doing anything, only thinking). What will happen if one day you decide to change the name of the books.html page to myBooks.html? Then you would have to go into every individual page on your Web site and change the link from books.html to myBooks.html. Again, a lot of work with a big chance of making a mistake. What should you do? Very soon you are going to embed the menu page menu.html in every one of the Web pages of your Web site. This means that you will have ONE menu page by the name of menu.html (that you have already created), but it will also be a part of every page on your Web site. Now you are probably thinking: "Wow! That's really cool! Every change I want to create to the menu (menu.html Web page) will be made on every other page too! But how will the other pages be updated?" Embedding HTML pagesYou do not copy the menu (the links) onto every one of the pages on your Web site, but instead you "embed" it. There is no menu on every Web page, but there is a kind of "room" or "space" in every page for the menu page (menu.html). As soon as the browser activates (loads) any page, it "absorbs" the content of the menu page into the activated page and displays it as one page. Below is an illustration of what will happen: ![]() Figure 9.2: Embedding an HTML page in another HTML page. Embedding an HTML page in another HTML page
Note - You can create a "room"or "space"for the menu.html Web page in any other page by using the <iframe>...</iframe> tag. Applying the menu for each pageRepeat items 1 to 7 for each of the other Web pages you created: about.html, books.html, friends.html, links.html. Verifying your Web site menu
Congratulations - you built a Web site!! Before you rush to call your Mom to show-off and share, here are some additional tiny improvements you can make. Some minor improvementsWeb site headerAdd justin's site as a heading at the top of all the Web pages.
To adjust the height of the <iframe> tag that contains the menu:
Web site header as a linkTo link the name of the site (justin's site)to the home page:
Link without underlineThe name of the site (justin's site) is a text link. A link is displayed with an underline. Usually the name of the site, which also serves as a link, is displayed without an underline. So how do you create a link without it being displayed as a link?
Now... run and call your Mom!
|