Forum Moderators: not2easy

Message Too Old, No Replies

border bottom not displaying correctly

         

relisoft

4:41 am on Mar 3, 2006 (gmt 0)

10+ Year Member



I am new to CSS so forgive me if the solution is obvious. Still i need help. I am creating a horizontal navigation menu. I have an outer wrapper that contains a list which is floated left and a div containing a search box floating right. I want to have a bottom border which spans under the entire length. This is why i have the outer wraper "nav_wrap". If i simply put border-bottom styling, it actually displays as a rule about my list and search. I have changed the border-bottom to red so you can see it easily. What am I doing wrong?

the page is located at [oooops]

Here's the code:
<style>
#mainnav
{
margin: 0;
padding: 0;
float: left;
list-style: none;
background:ffffff;
font-family:Arial, Helvetica, sans-serif;
font-size: 110%;
font-weight: bold;
}
.nav_home
{
margin: 0;
float:left;
padding: 3px 8px;
display: block;
color:#FFFFFF;
background-color: #000000;
}
.nav_home_select
{
margin: 0;
float:left;
padding: 3px 10px;
display: block;
color:#FFFFFF;
border-right: #FFFFFF thin solid;
}

.nav_coop
{
margin: 0;
float:left;
padding: 3px 10px;
display: block;
color: #CC6600;
border-right: #000 thin solid;

}
.nav_c
{
margin: 0;
float:left;
padding: 3px 10px;
display: block;
color: #5D855D;
border-right: #000 thin solid;
}
.nav_other
{
margin: 0;
float:left;
padding: 3px 10px;
display: block;
color:#508CD4;
border-right: #000 thin solid;
}

#search
{
padding: 1px;
margin: 0;
float: right;
}
#nav_wrap
{
border-bottom: #000000 thin solid;
}

</style>
</head>
<body>

<div id="nav_wrap">
<ul id="mainnav">
<li class="nav_home">Home</li>
<li class="nav_coop">Code Co-op</li>
<li class="nav_c">C++ Resources</li>
<li class="nav_other">Freeware</li>
<li class="nav_other">Science</li>
<li class="nav_other">Scoop</li>
<li class="nav_search"></li>
</ul>
<div id="search">
<form name='Search' action='Query.asp' method='get'>
<input type='text' name='InputString' size='12' maxlength='50' value='Search'>
<input type='submit' name='Action' value='GO'></form>
</div>
</div>

[edited by: SuzyUK at 9:55 pm (utc) on Mar. 3, 2006]
[edit reason] ooops sorry no URLs : see TOS #13 [WebmasterWorld.com] [/edit]

relisoft

4:48 am on Mar 3, 2006 (gmt 0)

10+ Year Member



Please note that I do realize that i could add a height to nav_wrap, but this would fix the height which doesn't work for someone that has their brower set to view text on a large setting. I want to make our site friendly such that someone view the text at a small setting and large setting will still see proper formating.

thanks!

relisoft

5:26 am on Mar 3, 2006 (gmt 0)

10+ Year Member



I'm still trying to solve this on my own. I did discover that i had no width for nav_wrap. I made this 100% and now the rule is below on IE but TOO LOW and it's still appearing above on Firefox.

I've uploaded the changed paged and changed the bottom-border to heavy black. Help.

jessejump

5:26 pm on Mar 3, 2006 (gmt 0)

10+ Year Member



Try adding form { margin: 0 }

relisoft

9:32 pm on Mar 3, 2006 (gmt 0)

10+ Year Member



thanks for your reply! I did what you suggested and that almost solved this in IE. The rule is still showing at the top in Firefox. I welcome any other suggestions!

thanks again.

doodlebee

11:02 pm on Mar 4, 2006 (gmt 0)

10+ Year Member



You aren't clearing your floats.

Both your "mainnav" and "search" divs are set to float left and right - but nothing is clearing them. Which means the bottom of your wrapper div has nothing to wrap.

Add this to your HTML:

<input type='submit' name='Action' value='GO'></form>
</div>
<hr />
</div>

and this to your CSS:

hr {
clear:both;
display:block;
visibility:hidden;}

That will clear your floats, and cause the main wrapper to understand there are things inside the div, and will expand it below the floated divs.