Welcome to Dream.In.Code
Getting Help is Easy!

Join 117,610 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,437 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



HTML/CSS positioning navbar issues

 
Reply to this topicStart new topic

HTML/CSS positioning navbar issues, More IE vs FF issues

BetaWar
post 14 Jun, 2008 - 07:58 PM
Post #1


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,569



Thanked 62 times

Dream Kudos: 975
My Contributions


Okay, I have fully working code (In IE6 and 7) but it has positioning issues in FF.

Here is my code:

CODE
<style>
body{
  background: url(cut/main_bg_01.png) top left repeat-x #ffffff;
  margin: 0px;
  padding: 0px;
}
.main_container{
  background: transparent;
  width: 880px;
  margin: 0px;
  padding: 0px;
  border: 0px;
  font-align: left;
}
.logo_hold{
  height: 60px;
  width: 120px;
}
.top_nav_section{
  height: 30px;
}
.nav_main{
  height: 30px;
}
.nav_active_link{
  color: #000099;
  text-decoration: none;
  height: 30px;
  margin: 0px 2px 0px 2px;
  cursor: hand;
}
.nav_active_link span.left{
  min-width: 7px;
  width: 7px;
  height: 30px;
  background: url(cut/nav_bar_link_bg_l_01.png) bottom right no-repeat transparent;
}
.nav_active_link span.middle{
  padding: 10px 4px 0px 4px;
  height: 30px;
  margin-right: -4px;
  background: url(cut/nav_bar_link_bg_01.png) bottom center repeat-x transparent;
}
.nav_active_link span.right{
  min-width: 7px;
  width: 7px;
  height: 30px;
  background: url(cut/nav_bar_link_bg_r_01.png) bottom left no-repeat transparent;
}

.nav_inactive_out, .nav_inactive_over{
  color: #6262ff;
  text-decoration: none;
  height: 30px;
  margin: 0px 2px 0px 2px;
  cursor: hand;
}

.nav_inactive_out span.left{
  min-width: 7px;
  width: 7px;
  height: 30px;
  background: url(cut/nav_bar_link_bg_03.png) bottom left no-repeat transparent;
}
.nav_inactive_out span.middle{
  padding: 10px 4px 0px 4px;
  height: 30px;
  margin-right: -4px;
  background: url(cut/nav_bar_link_bg_03.png) bottom left no-repeat transparent;
}
.nav_inactive_out span.right{
  min-width: 7px;
  width: 7px;
  height: 30px;
  background: url(cut/nav_bar_link_bg_03.png) bottom left no-repeat transparent;
}

.nav_inactive_over span.left{
  min-width: 7px;
  width: 7px;
  height: 30px;
  background: url(cut/nav_bar_link_bg_l_02.png) bottom right no-repeat transparent;
}
.nav_inactive_over span.middle{
  padding: 10px 4px 0px 4px;
  height: 30px;
  margin-right: -4px;
  background: url(cut/nav_bar_link_bg_02.png) bottom center repeat-x transparent;
}
.nav_inactive_over span.right{
  min-width: 7px;
  width: 7px;
  height: 30px;
  background: url(cut/nav_bar_link_bg_r_02.png) bottom left no-repeat transparent;
}
</style>

<script>
onerror=handleErr;
var txt="";
function handleErr(msg,url,l){
  txt="There was an error on this page.\n\n";
  txt+="Error: " + msg + "\n";
  txt+="URL: " + url + "\n";
  txt+="Line: " + l + "\n\n";
  txt+="Click OK to continue.\n\n";
  alert(txt);
}

  function init_function(){
    active_navb script:nav_select_new(this)" onmouseover="nav_hover(this)" onmouseout="nav_out(this)" class="nav_active_link" id="home_link">
          <span class="left"></span>
          <span class="middle">Home</span>
          <span class="right"></span>
        </span>

        <span onclick="java script:nav_select_new(this)" class="nav_inactive_out" onmouseover="nav_hover(this)" onmouseout="nav_out(this)">
          <span class="left"></span>
          <span class="middle">About Us</span>
          <span class="right"></span>
        </span>

        <span onclick="java script:nav_select_new(this)" class="nav_inactive_out" onmouseover="nav_hover(this)" onmouseout="nav_out(this)">
          <span class="left"></span>
          <span class="middle">Products/ Subscriptions</span>
          <span class="right"></span>
        </span>

        <span onclick="java script:nav_select_new(this)" class="nav_inactive_out" onmouseover="nav_hover(this)" onmouseout="nav_out(this)">
          <span class="left"></span>
          <span class="middle">Support Forums</span>
          <span class="right"></span>
        </span>

        <span onclick="java script:nav_select_new(this)" class="nav_inactive_out" onmouseover="nav_hover(this)" onmouseout="nav_out(this)">
          <span class="left"></span>
          <span class="middle">Login/ Register</span>
          <span class="right"></span>
        </span>

      </td>
    </tr>
  </table>
</center>


The javascript will eventually be a nice little ajax loader (saves time hopefully for the server and loading).

Here is a screenshot of what it looks like in IE (6 adn 7) working perfectly:
Attached Image

It should all be positioned inline and be nicely placed. I may decide to not make the site compatible with FF if I can't figure out how to get this working right. I just need it to look the same in FF as it does in IE; but as I have spent around an hour working on it to no avail I will let others take a look at the code an tell me the nice simple answer I have been missing for all this time smile.gif

Here are all the source files:
Attachment Removed

Thanks for any and all help in advance, I have been trying this for a while and haven't come up with a solution (yet). I will keep trying... hopefully I will still have hair when this is done...

Again, thanks.

This post has been edited by BetaWar: 16 Jun, 2008 - 12:07 AM
User is offlineProfile CardPM

Go to the top of the page


level1
post 15 Jun, 2008 - 11:11 PM
Post #2


New D.I.C Head

*
Joined: 12 Jun, 2008
Posts: 34



Thanked 5 times
My Contributions


Alright, I've seen how helpful you have been in the web forums so I went ahead and took a stab at it. You're using a table in your nav which makes me a little sad, but I didn't touch your html at all, just your styles. Here it is in all its glory working in FF, IE 6 - don't have IE7 to test on here. Should work, and if not you can see what I've done - mostly added floats to everything. FF won't show empty span bgs unless they are floating - there must be an explanation but I'm not sure what that is. I also adjusted heights of the center spans so that their height + padding matched the left and right spans. I think thats about it. Honest opinion is to just redo the whole thing using bg images the width you need them and do css rollovers to clean html up, but hey your code is working now so go with it.

QUOTE

<style>
body{
background: url(cut/main_bg_01.png) top left repeat-x #ffffff;
margin: 0px;
padding: 0px;
}
.main_container{
background: transparent;
width: 880px;
margin: 0px;
padding: 0px;
border: 0px;
font-align: left;
}
.logo_hold{
height: 60px;
width: 120px;
}
.top_nav_section{
height: 30px;
}
.nav_main{
height: 30px;
}
.nav_active_link{
color: #000099;
text-decoration: none;
height: 30px;
margin: 0px 2px 0px 2px;
cursor: hand;
float: left;
padding: 0;
}
.nav_active_link span.left{
width: 7px;
height: 30px;
background: url(cut/nav_bar_link_bg_l_01.png) bottom right no-repeat transparent;
float: left;
}
.nav_active_link span.middle{
padding: 7px 4px 7px 4px;
height: 23px;
margin-right: 0px;
background: url(cut/nav_bar_link_bg_01.png) top center repeat-x transparent;
float: left;
}
.nav_active_link span.right{
width: 7px;
height: 30px;
background: url(cut/nav_bar_link_bg_r_01.png) bottom left no-repeat transparent;
float: left;
}

.nav_inactive_out, .nav_inactive_over{
color: #6262ff;
text-decoration: none;
height: 30px;
margin: 0px 2px 0px 2px;
cursor: hand;
float: left;
}

.nav_inactive_out span.left{
width: 7px;
height: 30px;
background: url(cut/nav_bar_link_bg_03.png) bottom left no-repeat transparent;
float: left;
}
.nav_inactive_out span.middle{
padding: 7px 4px 0px 4px;
height: 23px;
margin-right: -4px;
background: url(cut/nav_bar_link_bg_03.png) top left no-repeat transparent;
float: left;
}
.nav_inactive_out span.right{
width: 7px;
height: 30px;
background: url(cut/nav_bar_link_bg_03.png) bottom left no-repeat transparent;
float: left;
}

.nav_inactive_over span.left{
width: 7px;
height: 30px;
background: url(cut/nav_bar_link_bg_l_02.png) bottom right no-repeat transparent;
float: left;
}
.nav_inactive_over span.middle{
padding: 7px 4px 0px 4px;
height: 23px;
margin-right: -4px;
background: url(cut/nav_bar_link_bg_02.png) top center repeat-x transparent;
float: left;
}
.nav_inactive_over span.right{
width: 7px;
height: 30px;
background: url(cut/nav_bar_link_bg_r_02.png) bottom left no-repeat transparent;
float: left;
}
</style>



The span -- .nav_active_link span.middle -- needed extra padding at bottom for IE to have bg image there. put bg image align top and it looks the same in FF, IE. Nice to help some1 so helpful.
User is offlineProfile CardPM

Go to the top of the page

BetaWar
post 15 Jun, 2008 - 11:21 PM
Post #3


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,569



Thanked 62 times

Dream Kudos: 975
My Contributions


Thanks SO much!!!! I have been wracking my brains for a day now trying to get it to work (with no avail) and here someone has came and saved my day!

I actually came kinda close (tried using floats to get it workin, looked a bit better but not right).

I know that tables are frowned upon, but they work and get things to behave nicely. Plus I am pretty much just using one table for the full layout (makes everything line up very well) which will be a lot more than it currently is, I just hadn't gotten that far when I ran into the issue.

Again thanks a TON!

PS - Works in IE7 also.

PSS - Enjoy the first Thanks I have given out so far.

This post has been edited by BetaWar: 15 Jun, 2008 - 11:21 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 11:38PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month