Forum Moderators: not2easy

Message Too Old, No Replies

border-bottom in firefox not working out

         

oluoch28394

4:33 am on Feb 3, 2009 (gmt 0)

10+ Year Member



I am designing a homepage and border-bottom does not seem to work in firefox. It looks fine in IE but it appears accross the middle in firefox. Any tips/hints.

#tabs {
height:auto;
font-size:100%;
color:#000000;
width:800px;
margin:0;
padding:0 80px 0 80px;
border-bottom:2px solid #CCCCCC;
}

simonuk

8:29 am on Feb 3, 2009 (gmt 0)

10+ Year Member



The code works fine for me. You probably have a problem elsewhere that is causing this one. At a guess maybe a height or position problem.

oluoch28394

12:11 am on Feb 4, 2009 (gmt 0)

10+ Year Member



Are you sure, coz its not working in my firefox browser. I have version 3.0.5 and the margin appears across the middle. Here's the html part and css again.

<div id="tabs">
<ul>
<li class="menupadding"><a href="#"><span>Bio</span></a></li>
<li class="menupadding"><a href="#"><span>Resume</span></a></li>
<li class="menupadding"><a href="#"><span>Portfolio</span></a></li>
<li class="menupadding"><a href="#"><span>Contact</span></a></li>
</ul>
</div>

#tabs {
position:relative;
top:0px;
font-size:100%;
color:#000000;
width:800px;
padding:0 80px 0 80px;
border-bottom:2px solid #999999;
}

choster

1:36 am on Feb 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It works perfectly fine for me in FF3. Have you tried validating your code? Perhaps an unclosed element or other error elsewhere in the page is to blame.

rocknbil

2:21 am on Feb 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard oluoch28394!

but it appears accross the middle in firefox.

Methinks there's more to this story. :-)

I was able to duplicate this like so:

.menupadding { display:inline; float: left; }

I'm prompted to think so by the name "tabs." If that is the case, remove the float. Noted mods:

- You can un-clutter the html by removing the classes, note the #tab ul li selector.
- Don't span inside an anchor, style the anchor instead.
- (Generally) the only reason to specify position:relative is to override a previous absolute, position is relative by default.
- divs have no margin by default, no reason to specify margin-top.
- I also question the padding, if your intent is to center, you can just use margin:auto.
- you may also want to add some margin/padding alts to #tab ul if you want to play with the spacing.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- doctype all on one line -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled</title>
<style type="text/css">
body,html { margin: 0; }
#tabs {
margin:auto;
font-size:100%;
color:#000000;
width:800px;
padding:0 80px 0 80px;
border-bottom:2px solid #999999;
}
#tabs ul { text-align: center; }
#tabs ul li { display:inline; }
</style>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#">Bio</a></li>
<li><a href="#">Resume</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</body>
</html>

swa66

7:42 am on Feb 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe a bit over the top with correctness, but I'd like to root out the misconception eventually.
position is relative by default

position:static is the initial value

position:relative allows the use of top/bottom/right/left to nudge the element away from it's in flow position without altering the space reserved for it in the flow.
position:relative also has a side effect in giving the element "position" as is referenced from children of the element that might have position absolute: the positioning is then done relative to the nearest parent that has position instead of to the viewport.

More info: [w3.org...]

rocknbil

5:42 pm on Feb 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<snicker> Man, I knew that one was coming. :-) Thanks.

Interested to know if this solved the problem though . . . .

oluoch28394

12:52 am on Feb 5, 2009 (gmt 0)

10+ Year Member



Sorry i was trying minimize the size of my post so you could not see why i used the span elements. My tabs have are expandable depending on the amount of text they hold, and they change colors as you hover. The tab image actually moves up in position to change color. Here is more of the css.
#tabs {
margin:auto;
font-size:100%;
color:#000000;
width:800px;
padding:0 80px 0 80px;
border-bottom:2px solid #999999;
}
#tabs li {
display:inline;
}
#tabs a {
float:left;
background:url("images/tableftF.gif") no-repeat left top;
padding:0 25px 0 4px;
text-decoration:none;
}
#tabs a span {
float:left;
display:block;
background:url("images/tabrightF.gif") no-repeat right top;
padding:5px 35px 5px 35px;
color:#000000;
text-align:center;
}

/* Commented Backslash Hack hides rule from IE5-Mac \*/
#tabs a span {float:none;}
/* End IE5-Mac hack */
#tabs a:hover span {
color:#FF6600;
}
#tabs a:hover {
background-position:0% -42px;
}
#tabs a:hover span {
background-position:100% -42px;
}

Nb. The tableftF.gif is just the left edge of the tab, while the tabrightF.gif is the rest of it.
I might use the menupadding class down the road or will remove them if I don't. As for the position, I put that to try fix the problem and hadn't removed it when it didn't work. The Html validates.

oluoch28394

1:59 am on Feb 5, 2009 (gmt 0)

10+ Year Member



I'm such an idiot, I just realized the problem might be the fact that the tab images are positioned lower and shift up to change colors. I suspect if I used different standard tabs there would be no problem. I wish firefox was as forgiving as IE. Thanx for your help guys. I will try putting the the border on top of the main body's div, which I haven't got around to creating as I was stumped by the stupid tabs.

oluoch28394

4:11 am on Feb 5, 2009 (gmt 0)

10+ Year Member



Specifying the exact height of the div to the height of the tab image fixed the problem.
#tabs {
height:29.5px;
margin:auto;
font-size:100%;
color:#000000;
width:800px;
padding:0 80px 0 80px;
border-bottom:2px solid #999999;
}
Thanks again.