views:

133

answers:

1

My problem is that I have a menu bar with z-index 100, and two elements of that bar with z-index 1000 (Sorry, in the code, the z-indexes are actually higher numbers butt different by a factor of 10... i realize this is bad practice, but i havent changed it yet because there are a few pieces connected). In firefox, the tweet button and facebook button always appear underneath the menu bar. it works perfectly in all other browsers. The live example is at my Los Angeles Food Truck Map. Here is some of the relevant code:

        #tweet_button{
            position:relative;
            left:6px;
            bottom:10px;
            z-index:100000000;
            }
...

    <div id="smoothmenu1">

<b id="tweet_button"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="truxmap">Tweet </a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"&gt;&lt;/script&gt;&lt;/b&gt;
            <span id="facebook_buton" style="color:white;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fla.truxmap.com&amp;amp;layout=button_count&amp;amp;show_faces=false&amp;amp;width=80&amp;amp;action=like&amp;amp;colorscheme=light&amp;amp;height=21" scrolling="no" frameborder="0" style="position:relative; left:10px;top:4px;border:none; overflow:hidden; height:35px; color:white;width:90px;overflow:hidden;z-index:100000000;" allowTransparency="true"></iframe></span>
    </div>

It may be important to note that I'm using GWT. I noticed that sometimes, the frame of the tweet button has one of the google ad sense ads superimposed upon it... i'm not quite sure why this is happening, but i figure its probably related to the solution.

Thanks a lot!!

+2  A: 

<b> is an inline element and cannot receive position or z-index, therefore either you need to declare display: block; or change the <b> to a <div>. I changed it to a div in Firebug and it worked fine, you just need to change the postioning a little with top and left.

EDIT: You already have bottom and left, so tweak these :)

Kyle Sevenoaks
Ohh right, I changed it to a b element because i was getting a different problem when using divs. When I insert divs there, the menu bar isnt always available for interaction in chrome, so i tried using an inline element and it worked. is there a way to make a div or some other more proper element work in this case?
culov
You can use the `<span>` element as it's inline, in the CSS write:`display: inline-block;` and that should fix it up for you :)
Kyle Sevenoaks
Thanks for the tip, your answer has helped me understand the last bits about elements that i was confused about. However, I still have the same issue have implementing your suggestions into the live version of my site at la.truxmap.com
culov
You have it set to `display: block;` according to what I can see in Chrome's developer tools, seems to be working fine, leave it at that :)
Kyle Sevenoaks
Right, it's been working in Chrome, but it's never been working properly in FF. In Chrome Dev Tools, I see that it breaks the moment I check the property "display:block" In Firefox, I can't get it to display correctly regardless of what I change in Firebug.
culov
@culov: because I did exactly that in my Firebug and it worked perfectly fine, apart from a few position tweaks..
Kyle Sevenoaks
@Kyle So if you go to http://truxmap.com right now and change the css for #tweet_button in firebug from 'display:inline-block;' to 'display:block;' the tweet button is visible to you? When I do that, I just get a 3 or 4 pixel white space underneath the menu and the button still isnt visible. Thanks for your help on this-- I know we've got to be really close to the solution.
culov
Hi, after looking more in depth through your code, you have a lot of z-index conflicts. The parent element `<div id="smoothmenu1">` has `z-index: 10000000;`. All of its children will have the same thing, so disable all z-indexes for all of its children, then see what happens. :)
Kyle Sevenoaks
I tried disabling every z-index period, except the "smoothmenu1" value, and it didnt ever display the tweet button. One point I have to make is that something similar is happening with the adsense ads as well, in firefox. However, unlike the social media buttons, the ads are SOMETIMES visible. When they are not visible, they seem to completely disappear but do leave a trace. I can observe this because the ad ought to extend about 500px vertically-- when the screen is re-sized to smaller than this, the transparent frame of the ad adds a scroll bar to the window because its still in the DOM
culov
I have discovered that by placing both buttons in a container, and positioning the container absolutely, i can get the buttons to show over the menu bar. this obviously isnt the ideal solution, so im still looking for a better way to accomplish this.
culov
That's not a bad way of going about it, I was going to suggest that next. If it works and validates then it's fine :). I've used this solution quite a few times and it rarely breaks, good job :)
Kyle Sevenoaks