Home arrow HTML arrow Page 2 - HTML for a Common Browser Menu
HTML

HTML for a Common Browser Menu


In this part of the series I describe the HTML elements and their attributes. I do not talk about the events in this part; I will talk about the events in a later part. I will also talk about the CSS for the menu elements and sub menu elements. Throughout the series, we shall use the example that was described in the previous part.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
March 13, 2009
TABLE OF CONTENTS:
  1. · HTML for a Common Browser Menu
  2. · More on the Elements and Attributes
  3. · The Table Cell Contents in the DIV
  4. · The Style Sheet

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
HTML for a Common Browser Menu - More on the Elements and Attributes
(Page 2 of 4 )

The DIV element has an ID and the style attribute. We shall talk about the use of the ID later. The first property in the style attribute is the position property. The value of the position property is "absolute." When you give the "absolute" value to the position property of an element and you do not give the element the CSS left and top properties, the element will remain in the position of the normal flow.

However, under this condition, the element will appear in front the other elements in the normal flow, beginning from the position where it was put. An element will appear in front of another depending on the z-indices of the two elements. The one with the higher z-index appears in front. The BODY element behaves as if it has a z-index of zero. Elements in the normal flow behave as if they have a z-index of 1. So I gave the DIV element a z-index of 10 to make sure it appears in front of the elements around it. It would hardly ever happen that any element in your web page would have a z-index of up to 10.

The background of the DIV is transparent. The value of the display property is "block." Since the z-index value is 10, the DIV appears in front of all the elements behind it. When any sub menu item has to be displayed, the background of its cell is given a color. So you do not see through the DIV where table cells have background color, but you see through the DIV where there is no cell background color. For simplicity and compatibility between browsers, the border-width of the DIV is zero, the padding is zero and the margin is zero. Note that different browsers may have different default values for these three properties.

The table inside the DIV element has a cellpadding of zero, a cellspacing of zero and border of zero. The widths of the columns of the table in the DIV are the same as the widths of the columns of the table in the main menu. This is done by CSS.

With all these specifications, the corresponding columns between the table in the main menu and the table in the DIV are aligned. So when you click the Drop Down button, the sub vertical menu you see appears directly below the corresponding link in the main menu.

Do not forget to give a width (value) for the DIV element; otherwise the code will not work with the three browsers that I have mentioned.


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



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