January 1, 200917 yr Need some help please im trying to get my search bar to display within my navbar on the right but what ever i try it seems to stay below the navigation. The css for the search box: .msearch { width:auto; height:37px; float:left; position:block; padding: 0; margin: 0; and the html/php for the nav and search box <ul id="nav"> <? if(isset($_COOKIE["user"])){ echo" <li><a href='./index.php?action=myhome'>Home</a></li>"; }else{ echo" <li><a href='./index.php'>Home</a></li>"; } ?> <li><a href="./ladders.php" class="parent">Ladders</a> <ul> <li><a href="./standings.php?ladder[id]=4" class="news">Warhawk Team Ladder</a></li> <li><a href="./standings.php?ladder[id]=5" class="news">Warhawk Doubles Ladder</a></li> <li><a href="./standings.php?ladder[id]=6" class="news">Warhawk Singles Ladder</a></li> </ul> </li> <li><a href="./tournaments.php" class="parent">Tournaments</a> <ul> <li><a href="./tournaments.php?tourney[id]=1" class="news">Warhawk Team Tournament</a></li> </ul> </li> <li><a href="">Teams</a></li> <li><a href='./freeagents.php'>Free Agents</a></li> <li><a href="./members.php" class="parent">Members</a> <ul> <li><a href="./members.php" class="news">Rankings</a></li> <li><a href="./members.php" class="news">Member search</a></li> </ul> </li> <li><a href='http://www.transatlantickillers.co.cc'>Forums</a></li> <li><a href="#" class="parent">More</a> <ul> <li><a href="./apply.php" title="Apply for staff" class="member">Apply for staff</a></li> <li><a href="./admincp" class="member">Staff Page</a></li> <li><a href="./help.php" class="forum">Help</a></li> </ul> </li> <div class="msearch"> <form method="post" action="./search.php"> <input type="text" name="search[string]" class="sbox" maxlength="30" style="vertical-align:middle;" value="Search Ladders" onClick="this.value=''"> <input type="hidden" name="search[type]" value="ladd"> <input type="image" src="./theme/default/images/index_16.png" name="button" class="sbutton" style="vertical-align:middle;"> </form> </div> </ul> Any help will be much appreciated ive just spent the last two hours trying to figure this out and its finally drove me crazy lol
January 1, 200917 yr If you set the <ul> to have position:relative, you could then place the search box absolutely inside that. #nav { position:relative; } #nav div.msearch { position:absolute; top:0; right:0; } Could you post the css for the <ul> or, even better, is the site 'live' at the moment?
January 1, 200917 yr Author Thanks Elanman positioning the search box absolute has got it within the navbar but its too far to the right now, ive tried left: 800; but no matter what number i put in there left or right it keeps sending it to the far left unless its at 0. The css for ul #nav { width: 1000px; height: 29px; background-image: url(./theme/default/images/nav.jpg); background-repeat: no-repeat; margin: 0 auto; z-index: 5000; line-height: 27px; position:relative; } #nav ul { float: left; width: auto; height: 26px; margin: 0; padding: 4px 0 0 90px; z-index: 5000; } #nav li { display: inline; position: relative; list-style-type: none; color: #fff; z-index: 5000; } #nav li ul { width: 200px; display: none; padding: 0; margin: 0; position: absolute; left: 4px; top: 17px; z-index: 5000; } and the site live link Thanks again
January 1, 200917 yr Ahh, that's to possition the first LI. Change the width to 960px; (960px + 40px[padding] == 1000px)
January 2, 200917 yr To change the absolute position of msearch, use .msearch { position:absolute; top:0; right:20px; / * or whatever you want * / } Remember to state the measurement unit ( px, em) unless the value is 0.
Create an account or sign in to comment