473,773 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

horizontal dropdown menu using html and css

35 New Member
hi,

I have a single column webpage with a horizontal dropdown menu and am trying to make the nav bar fit across the page, the column is 800px, it looks ok in dreamweaver 8 but when I test it in firefox, the nav bar which is a horizontal blue stripe with the links written inside it doesn't stretch the whole 800px, also how would you align the words in the submenu to the main menu, currently the submenus are centered

html
Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <div id="wrapper">
  3.  
  4.  
  5. <div id="headerimage">
  6. <img src="../2nd_ level/header .jpg" alt="image of rocks and grass" /></div>
  7.  
  8. <div id="menuh-container">
  9. <div id="menuh">
  10.  
  11.     <ul>
  12.         <li><a href="file:///C|/Drews Views/index.html" class="top_parent">Home</a>
  13.         <ul>
  14.             <li><a href="#"><a></li>
  15.             <li><a href="#" class="parent"></a>
  16.                 </ul>
  17.                   </ul>
  18.                     </li>    
  19.  
  20.     <ul>
  21.         <li><a href="#" class="top_parent">About</a>
  22.         <ul>
  23.             <li><a href="#"></a></li>
  24.             <li><a href="#" class="parent"></a>
  25.                 </ul>
  26.       </ul>
  27.                     </li>        
  28.  
  29.      <ul>
  30.          <li><a href="#" class="top_parent">Construction</a>
  31.          <ul>
  32.             <li><a href="#">Rock Work</a></li>
  33.             <li><a href="#" class="parent">Water Feature</a>
  34.                 </ul>
  35.                   </ul>
  36.                     </li>    
  37.  
  38.        <ul>
  39.         <li><a href="#" class="top_parent">Design</a>
  40.         <ul>
  41.             <li><a href="#"><a></li>
  42.             <li><a href="#" class="parent"></a>
  43.                 </ul>
  44.                   </ul>
  45.                     </li>
  46.         <ul>
  47.         <li><a href="#" class="top_parent">Contact</a>
  48.         <ul>
  49.             <li><a href="#"><a></li>
  50.             <li><a href="#" class="parent"></a>
  51.                 </ul>
  52.                   </ul>
  53.                     </li>                                                                        
  54. </div>
  55. </div>    
  56.  
  57.  
  58. <div id="content">  
  59. <div id="maincontent"><!-- TemplateBeginEditable name="text" -->
  60.   <p>&nbsp;</p>
  61.   <!-- TemplateEndEditable --></div>
  62.  
  63. <div id="footer">
  64.   Contact:&nbsp; &nbsp; Mobile: 0418 134 812 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Office: (03)5965 2285  &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Email: drew.ad@bigpond.net.au </div>
  65.  
  66. &nbsp;
  67. <div id="copyright">&nbsp; &nbsp;
  68. Copyright &copy; 2003-2007 l All rights reserved &nbsp; &nbsp;</div>
  69.  
  70.  
  71. </div>
  72. </div>
  73. </body>
  74.  
  75. CSS
  76.  
  77. #menuh-container
  78. {
  79. top:2em;
  80. left:0;
  81. }
  82.  
  83. #menuh
  84. {
  85. font-size: small;
  86. font-family: "century gothic";
  87. width:800px;
  88. margin:0;
  89. margin-top:0;
  90. }
  91.  
  92. #menuh a
  93. {
  94. text-align: center;
  95. display:block;
  96. border: 1px thin #e1edf0;
  97. white-space:nowrap;
  98. margin:0;
  99. padding: 0.2em;
  100. }
  101.  
  102. #menuh a, #menuh a:visited /* menu at rest */
  103. {
  104. color:#000000;
  105. background-color:#e1edf0;
  106. text-decoration:none;
  107. }
  108.  
  109. #menuh a:hover /* menu at mouse-over */
  110. {
  111. color:#000000;
  112. background-color:#eaf2f4;
  113.  
  114. #menuh a.top_parent, #menuh a.top_parent:hover 
  115. {
  116. background-repeat: no-repeat;
  117.  
  118. }
  119.  
  120. #menuh a.parent, #menuh a.parent:hover 
  121. {
  122. background-repeat: no-repeat;
  123. }
  124.  
  125. #menuh ul
  126. {
  127. list-style:none;
  128. margin:0;
  129. padding:0;
  130. float:left;
  131. width:11.75em; /* width of all menu boxes */
  132. }
  133.  
  134. #menuh li
  135. {
  136. min-height: 1px; 
  137. vertical-align: bottom; 
  138. }
  139.  
  140. #menuh ul ul
  141. {
  142. position:absolute;
  143. z-index:500;
  144. top:auto;
  145. display:none;
  146. padding:1em;
  147. margin:-1em 0 0 -1em;
  148.  
  149. }
  150.  
  151. #menuh ul ul ul
  152. {
  153. top:0;
  154. left:100%;
  155. }
  156.  
  157. div#menuh li:hover
  158. {
  159. cursorointer;
  160. z-index:100;
  161. }
  162.  
  163. div#menuh li:hover ul ul,
  164. div#menuh li li:hover ul ul,
  165. div#menuh li li li:hover ul ul,
  166. div#menuh li li li li:hover ul ul
  167. {display:none;}
  168.  
  169. div#menuh li:hover ul,
  170. div#menuh li li:hover ul,
  171. div#menuh li li li:hover ul,
  172. div#menuh li li li li:hover ul
  173. {display:block;}
  174.  
thanks
Mar 30 '07 #1
1 6617
KevinADC
4,059 Recognized Expert Specialist
why don't you get rid of this div:

#menuh-container
{
top:2em;
left:0;
}


and put those properties in the menu div
Mar 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
5030
by: elad | last post by:
Hi The Menu doesn't work properly when I have 2 frame and the Menu popup frame=document target frame, when I choose item in the menu the doc opened and the menu get stuck. Here is the code I'm using: FrameSet ------------------------------------------------------- <html>
4
13274
by: Papa Legba | last post by:
I'm looking for a Seeking pure CSS horizontal menu with sub-menus which drop down on mouse over. Compatible with as many browsers as possible. Any ideas?
2
2421
by: polo | last post by:
Hi i am trying to get a horizontal menu and sub menu in css, which works great on my Firefox But, in order to get around the ie hover bug, i included some javascript which gives me a strange result... I admit i got recent help by Stephane on the js code (thanks) here is my code for anyone with a suggestion as to how to mimic the css properties "inline" or "float" on ie and get the same result as in FF:
0
1281
by: Randy Smith | last post by:
Hi All, My menu control doesn't "dropdown". The "Home" menu item doesn't appear, nor does the "Jobs" item. And, the 2nd group (Labor and Materials) in web.sitemap doesn't appear at all. The Here's what web.sitemap looks like: <?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode title="Home" url="ShowAllJobs.aspx">
2
9330
by: Sergio E. | last post by:
Hi group, I write this post with the following question: How can I to build an absolutely horizontal menu?, This is because I can't find how can I configure the menu component of asp.net 2.0 in vs2005. I need somthing like this: the root menu in this form
2
10298
by: William Youngman | last post by:
We are developing an application that presents data to the user in a gridview and we are using the dropdown extender to give the user a SharePoint 2007 type dropdown menu attached to the cells of a given column. We are also using another dropdown menu that the user can use to select data using another quesry using the SelectedIndex change method. Upon initial page load everything works fine and the user is presented with a SharePoint type menu....
19
3695
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the code for this from a tutorial but that menu was flush-left justified. Not what I want. Subsequent searches on google on how to center yielded a
17
13588
by: Nyris | last post by:
I have this code used for the navigation on an HTML page. It's an accordion style dropdown menu. Everything works fine I just need to change it so that the submenuheader class allows it to be a clickable link. Right now all that happens with for example Home has two submenus of About Us and Quality. When you click home it expands the dropdown. But I want it to expand and also direct to a Home page. thanks in advance! var ddaccordion={...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.