Badman3k
03-12-2009, 12:38 PM
I've been working on a horizontal menu system with two rows, the top for the main cats and then the 2nd under it with pages within the cat.
So far I've got the CSS and HTML to work relatively well, with the hovering and etc. See the below code (which is a full testing page):
<html>
<head>
<title>Menu Tester</title>
</head>
<body>
<div id='menu'>
<ul>
<li><a href="/dashboard.html" title="Home"><img src="/images/buttons/home.png" alt="Home" /> Home</a> <span class="navborder"> </span></li>
<li><a href="/customers/index.html" title="Customers"><img src="/images/buttons/customers.png" alt="Customers" /> Customers</a> <span class="navborder"> </span>
<ul>
<li><a href="/customers/add_customer.html" title="Add Customer">Add Customer</a></li>
<li><a href="/customers/view_customers.html" title="View Customers">View Customers</a></li>
<li><a href="/customers/add_site.html" title="Add Site">Add Site</a></li>
<li><a href="/customers/view_sites.html" title="View Sites">View Sites</a></li>
<li><a href="/customers/add_contact.html" title="Add Contact">Add Contact</a></li>
<li><a href="/customers/view_contacts.html" title="View Contacts">View Contacts</a></li>
</ul>
</li>
<li><a href="/suppliers/index.html" title="Suppliers"><img src="/images/buttons/suppliers.png" alt="Suppliers" /> Suppliers</a> <span class="navborder"> </span>
<ul>
<li><a href="/suppliers/add_supplier.html" title="Add Supplier">Add Supplier</a></li>
<li><a href="/suppliers/view_suppliers.html" title="View Suppliers">View Suppliers</a></li>
<li><a href="/suppliers/add_rep.html" title="Add Rep">Add Rep</a></li>
<li><a href="/suppliers/view_reps.html" title="View Reps">View Reps</a></li>
</ul>
</li>
<li><a href="/projects/index.html" title="Projects"><img src="/images/buttons/projects.png" alt="Projects" /> Projects</a> <span class="navborder"> </span>
<ul>
<li><a href="/projects/add_project.html" title="Add Project">Add Project</a></li>
<li><a href="/projects/view_projects.html" title="View Projects">View Projects</a></li>
<li><a href="/projects/view_costs.html" title="Review Project Costs">Review Project Costs</a></li>
<li><a href="/projects/view_engineers.html" title="Project Distribution">Project Distribution</a></li>
<li><a href="/projects/add_document.html" title="Add Document">Add Document</a></li>
<li><a href="/projects/view_documents.html" title="View Documents">View Documents</a></li>
</ul>
</li>
<li><a href="/procurement/index.html" title="Procurement"><img src="/images/buttons/procurement.png" alt="Procurement" /> Procurement</a> <span class="navborder"> </span>
<ul>
<li><a href="/procurement/add_order.html" title="Add Order">Add Order</a></li>
<li><a href="/procurement/view_orders.html" title="View Orders">View Orders</a></li>
<li><a href="/procurement/approve_orders.html" title="Approve Orders">Approve Orders</a></li>
</ul>
</li>
<li><a href="/finance/index.html" title="Finance"><img src="/images/buttons/finance.png" alt="Finance" /> Finance</a> <span class="navborder"> </span>
<ul>
<li><a href="/finance/add_invoice.html" title="Add Invoice">Add Invoice</a></li>
<li><a href="/finance/view_invoices.html" title="View Invoices">View Invoices</a></li>
<li><a href="/finance/add_billed_invoice.html" title="Add Billed Invoice">Add Billed Invoice</a></li>
<li><a href="/finance/view_billed_invoices.html" title="View Billed Invoices">View Billed Invoices</a></li>
</ul>
</li>
<li><a href="/admin/index.html" title="Admin"><img src="/images/buttons/admin.png" alt="Admin" /> Admin</a> <span class="navborder"> </span>
<ul>
<li><a href="/admin/add_user.html" title="Add User">Add User</a></li>
<li><a href="/admin/view_users.html" title="View Users">View Users</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>
Following this I assign the following CSS rules:
#menu {
position: absolute;
top: 137px;
width: 100%;
background: url(/images/bg/nav_bg.png) repeat-x;
height: 103px;
font-size: 14px;
font-weight: bold;
}
#menu ul {
padding: 0;
margin: 0;
margin-left: -1px;
list-style-type: none;
border: 0;
position: relative;
top: 0;
left: 0;
color: #FFFFFF;
height: 50px; /* Height of the menu */
}
#menu ul li {
float: left;
padding: 0;
margin: 0;
display: block;
float: left;
}
#menu ul li a {
border: 0;
text-decoration: none;
display: block;
height: 35px; /* Height of the menu */
padding: 0 12px;
padding-top: 15px;
}
#menu ul li span.navborder {
background: url(/images/bg/navitem_border_bg.png) no-repeat;
position: absolute;
top: 0;
padding: 0;
margin: 0;
width: 1px;
height: 100%;
}
#menu ul li a:hover {
border: 0;
display: block;
background: url(/images/bg/navitem_arrow_bg.png) no-repeat bottom center;
}
#menu ul li:hover {
background: url(/images/bg/navitem_hover_bg.png) repeat-x;
}
#menu ul li ul {
display: block;
visibility: hidden;
position: absolute;
left: 0;
top: 50px;
height: 50px;
margin: 0;
color: #142e45;
}
#menu li:hover ul {
visibility: visible;
z-index: 100;
}
#menu li:hover ul li {
background: none;
}
#menu li:hover ul li a:hover{
background: none;
}
This shows the menu in two rows, with the second ULs hidden until it's parent LI is hovered over.
My problem is with the end LIs of the top menu, as their ULs are not 'long' enough to reach them thus trying to click one the subpages is impossible. What I would really like to do is have the second ul 'centered' about the center of it's parent LI. However, if this is not possible, making the second UL wider so that I can actually click on the subpages.
I hope that this is clear, but if not let me know and I'll try again.
Many thanks in advance,
So far I've got the CSS and HTML to work relatively well, with the hovering and etc. See the below code (which is a full testing page):
<html>
<head>
<title>Menu Tester</title>
</head>
<body>
<div id='menu'>
<ul>
<li><a href="/dashboard.html" title="Home"><img src="/images/buttons/home.png" alt="Home" /> Home</a> <span class="navborder"> </span></li>
<li><a href="/customers/index.html" title="Customers"><img src="/images/buttons/customers.png" alt="Customers" /> Customers</a> <span class="navborder"> </span>
<ul>
<li><a href="/customers/add_customer.html" title="Add Customer">Add Customer</a></li>
<li><a href="/customers/view_customers.html" title="View Customers">View Customers</a></li>
<li><a href="/customers/add_site.html" title="Add Site">Add Site</a></li>
<li><a href="/customers/view_sites.html" title="View Sites">View Sites</a></li>
<li><a href="/customers/add_contact.html" title="Add Contact">Add Contact</a></li>
<li><a href="/customers/view_contacts.html" title="View Contacts">View Contacts</a></li>
</ul>
</li>
<li><a href="/suppliers/index.html" title="Suppliers"><img src="/images/buttons/suppliers.png" alt="Suppliers" /> Suppliers</a> <span class="navborder"> </span>
<ul>
<li><a href="/suppliers/add_supplier.html" title="Add Supplier">Add Supplier</a></li>
<li><a href="/suppliers/view_suppliers.html" title="View Suppliers">View Suppliers</a></li>
<li><a href="/suppliers/add_rep.html" title="Add Rep">Add Rep</a></li>
<li><a href="/suppliers/view_reps.html" title="View Reps">View Reps</a></li>
</ul>
</li>
<li><a href="/projects/index.html" title="Projects"><img src="/images/buttons/projects.png" alt="Projects" /> Projects</a> <span class="navborder"> </span>
<ul>
<li><a href="/projects/add_project.html" title="Add Project">Add Project</a></li>
<li><a href="/projects/view_projects.html" title="View Projects">View Projects</a></li>
<li><a href="/projects/view_costs.html" title="Review Project Costs">Review Project Costs</a></li>
<li><a href="/projects/view_engineers.html" title="Project Distribution">Project Distribution</a></li>
<li><a href="/projects/add_document.html" title="Add Document">Add Document</a></li>
<li><a href="/projects/view_documents.html" title="View Documents">View Documents</a></li>
</ul>
</li>
<li><a href="/procurement/index.html" title="Procurement"><img src="/images/buttons/procurement.png" alt="Procurement" /> Procurement</a> <span class="navborder"> </span>
<ul>
<li><a href="/procurement/add_order.html" title="Add Order">Add Order</a></li>
<li><a href="/procurement/view_orders.html" title="View Orders">View Orders</a></li>
<li><a href="/procurement/approve_orders.html" title="Approve Orders">Approve Orders</a></li>
</ul>
</li>
<li><a href="/finance/index.html" title="Finance"><img src="/images/buttons/finance.png" alt="Finance" /> Finance</a> <span class="navborder"> </span>
<ul>
<li><a href="/finance/add_invoice.html" title="Add Invoice">Add Invoice</a></li>
<li><a href="/finance/view_invoices.html" title="View Invoices">View Invoices</a></li>
<li><a href="/finance/add_billed_invoice.html" title="Add Billed Invoice">Add Billed Invoice</a></li>
<li><a href="/finance/view_billed_invoices.html" title="View Billed Invoices">View Billed Invoices</a></li>
</ul>
</li>
<li><a href="/admin/index.html" title="Admin"><img src="/images/buttons/admin.png" alt="Admin" /> Admin</a> <span class="navborder"> </span>
<ul>
<li><a href="/admin/add_user.html" title="Add User">Add User</a></li>
<li><a href="/admin/view_users.html" title="View Users">View Users</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>
Following this I assign the following CSS rules:
#menu {
position: absolute;
top: 137px;
width: 100%;
background: url(/images/bg/nav_bg.png) repeat-x;
height: 103px;
font-size: 14px;
font-weight: bold;
}
#menu ul {
padding: 0;
margin: 0;
margin-left: -1px;
list-style-type: none;
border: 0;
position: relative;
top: 0;
left: 0;
color: #FFFFFF;
height: 50px; /* Height of the menu */
}
#menu ul li {
float: left;
padding: 0;
margin: 0;
display: block;
float: left;
}
#menu ul li a {
border: 0;
text-decoration: none;
display: block;
height: 35px; /* Height of the menu */
padding: 0 12px;
padding-top: 15px;
}
#menu ul li span.navborder {
background: url(/images/bg/navitem_border_bg.png) no-repeat;
position: absolute;
top: 0;
padding: 0;
margin: 0;
width: 1px;
height: 100%;
}
#menu ul li a:hover {
border: 0;
display: block;
background: url(/images/bg/navitem_arrow_bg.png) no-repeat bottom center;
}
#menu ul li:hover {
background: url(/images/bg/navitem_hover_bg.png) repeat-x;
}
#menu ul li ul {
display: block;
visibility: hidden;
position: absolute;
left: 0;
top: 50px;
height: 50px;
margin: 0;
color: #142e45;
}
#menu li:hover ul {
visibility: visible;
z-index: 100;
}
#menu li:hover ul li {
background: none;
}
#menu li:hover ul li a:hover{
background: none;
}
This shows the menu in two rows, with the second ULs hidden until it's parent LI is hovered over.
My problem is with the end LIs of the top menu, as their ULs are not 'long' enough to reach them thus trying to click one the subpages is impossible. What I would really like to do is have the second ul 'centered' about the center of it's parent LI. However, if this is not possible, making the second UL wider so that I can actually click on the subpages.
I hope that this is clear, but if not let me know and I'll try again.
Many thanks in advance,