FirefighterKyle
I am Kyle!!
- Sep 14, 2012
- 162
- 7
Alright so I am trying to make a navigation bar,
Css code
and here is my php/html
So what is happening is when I hover over Test it does not bring the I guess subnavi we can call it or drop down menu out side of the ul bar. I am trying to figure out if there is a way to have the <div dropdown menu/navi to ignore the ul?
Css code
Code:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
border-radius: 10px;
}
#navi
{
clear:both;
font-size:15px;
text-align: center;
}
#navi li
{
float:left;
height:30px;
white-space:nowrap;
}
#navi li strong,#navi li a
{
background-color: #333;
color:#fff;
float:left;
font-weight:400;
height:24px;
max-width:290px;
overflow:hidden;
padding:6px 16px 0 22px;
text-decoration:none;
text-overflow:ellipsis;
}
#navi li span
{
overflow: hidden;
background-color: #333;
float:left;
height:30px;
}
#navi li.selected strong,#navi li.selected a
{
background-color: #2F8ADD;
color:#fff;
font-weight:700;
}
#navi li.selected span
{
background-color: #2F8ADD;
}
#navi li:hover strong,#navi li:hover a
{
background-color: #000;
}
#navi li:hover span
{
background-color: #333;
}
#navi li.selected:hover strong,#navi li.selected:hover a
{
background-color: #2F8ADD;
}
#navi li.selected:hover span
{
background-color: #2F8ADD;
}
#navi li.metab i
{
background:transparent none no-repeat left 50%;
font-style:normal;
padding-left:16px;
}
.dropdown {
position: absolute;
color: #fff;
clear: right;
}
.dropdown-content {
display: none;
background-color: #333;
color: #fff;
min-width: 40px;
padding: 12px 16px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
position: absolute;
right: 10px;
top: 38px;
display: block;
}
.dropdown-content:hover
{
background-color: #000;
}
and here is my php/html
PHP:
<?php if (!isset($nav)) {
$nav = "1";
} ?>
<ul id="navi">
<?php if ($nav == "1") { ?>
<li class="selected">
<strong>Home</strong>
<span></span>
</li>
<?php } else { ?>
<li>
<a href="{url}/index">Home</a>
<span></span>
</li>
<?php } ?>
<?php if ($nav == "2") { ?>
<li class="selected">
<strong>Staff</strong>
<span></span>
</li>
<?php } else { ?>
<li>
<a href="{url}/staff">Staff</a>
<span></span>
</li>
<?php } ?>
<?php if ($nav == "3") { ?>
<li style="float:right" class="selected">
<Strong>Test</strong>
<span></span>
</li>
<?php } else { ?>
<li style="float:right">
<div class="dropdown" style="clear:right">
<a href="{url}/test">Test</a>
<span></span>
<div class="dropdown-content">
<p>Hello World!</p>
</div>
<div class="dropdown-content">
<p>Hello World2!</p>
</div>
</div>
</li>
<?php } ?>
</ul>