Home arrow HTML arrow Quick Web Page Menu
HTML

Quick Web Page Menu


Many applications (e.g. Microsoft Word) have a menu as their first bar. If you have a web site that has many pages, you can create a similar menu bar where, if you click a menu item, a drop-down menu with links will appear over other content on the page. You might have seen this on some web pages already. Keep reading if you would like to learn how to build this for your web site.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 8
April 30, 2008
TABLE OF CONTENTS:
  1. · Quick Web Page Menu
  2. · Strategy
  3. · Code continued
  4. · Explanation of Code

print this article
SEARCH DEVARTICLES

Quick Web Page Menu
(Page 1 of 4 )

Introduction

In this article, I show you how you can design such a menu when you are in a hurry. You can also take this as a basis to design a menu for commercial purposes. To understand this article, you should have basic knowledge of HTML, Cascading Style Sheets and JavaScript.

Preliminaries

We need to be aware of certain things before we continue to the analysis. The first item we need to know is how positioning in HTML works.

There is a CSS property called the Position property. It is used to position an HTML element anywhere on a web page. This property can take the value "absolute;" it can also take the value "relative." So if you want to position a DIV element for example, on a web page you can begin the syntax for the DIV element in your CSS like this:


div {position:absolute ...


or


div {position:relative ...


The value of "absolute" positions the element on the web page by taking the top-left corner of the client area of the web page as the origin, with coordinates (0px, 0px). When you use absolute positioning, the element (DIV in this example) will not occupy any space that another element would have taken, with the normal flow as you place elements as content of the BODY tag. This means that if you place another element normally, it may lie behind or in front of the element with the absolute position property.

The value of "relative" does not change the position of the element in the normal flow as you place it, as content of the BODY tag. The element occupies space in the area where you place it as content of the BODY tag.

The CSS z-index Property

The CSS z-index property sets the stack order of an element. An element with a larger stack order is always in front of another element with lower stack order. In simple terms, the z-index property allows an element to be placed in front or behind another element as seen by the viewer of the web page. The z-index is a number and an element with the greater number appears in front of an element with the smaller number.

Note: the z-index property only works on elements that have the position property.

If you create an element and give it the absolute position property (position:absolute), but do not give it the Left and Top property, the element should remain where you placed it in the normal flow as content of the BODY tag. It will still not occupy space. It will still be able to lie in front or behind elements that occupy space and take their position normally in the normal flow.


blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials