Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > CSS > CSS Cascading Style Sheets
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2005, 06:28 PM
Registered User
 
Join Date: Aug 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default z-index layering problem ie6 vs firefox

okay - it's getting late in my corner of the world and I've lost the plot. I'm trying to layer two elements in a horizontal navigation - one is a bar, one is the button above (button is done via unordered list). The button should overlay the bar to give a "you are here" effect. Images to show what I mean are here:
http://www.wroxham.net/teststuff/menu_problem.html

The CSS code is (only part - the full stylesheet is huge):
div.bar_welcome {
    width: 608px;
    height: 14px;
    border-width: 1px 1px 0px 1px; border-style: solid; border-color: rgb(125,113,112);
    margin: 0px; padding: 0px;
    position: absolute; left: 160px; top: 115px;
    background: url('images/bar_welcome.jpg') 0 0 repeat-x;
    z-index: 0;
}

#nav {
    position: absolute; left: 225px; top: 87px;
    margin: 0px; padding: 0px;
}

#nav ul {
    margin: 0px; padding: 0px;
    list-style: none;
}

#nav ul li a.welcome {
    margin: 0px; padding: 5px 10px 7px 10px;
    font-size: 13px;
    float: left;
    background: rgb(232,189,77);
    position: relative; z-index: 20;
}

#nav ul li a:hover {
    background: none;
}

#nav ul li.wn {
    display: block;
    text-decoration: none;
    color: rgb(0,0,0);
    margin: 0px 10px 0px 0px;
    font-size: 13px;
    padding: 0px;
    float: left;
    background: rgb(232,189,77);
    border-width: 1px 1px 0px 1px; border-style: solid; border-color: rgb(125,113,112);
}

The HTML is:
<div id="nav">
 [list]
   <li class="wn"><a class="welcome" href="index.php">Welcome</a></li>
 </ul>
</div>
<div class="bar_welcome"></div>

The menu works with an unordered list which on hover shows the ul background (to speed image loading times up hover has no background itself). In normal state though the <a class="welcome"> should appear OVER the div.bar_welcome ... and it doesn't in IE (in Firefox of course it works fine)

My gut feeling is that IE doesn't like the fact that the bar is a div whilst the <a class=""> is only a humble list/link thingy.

oh well - will battle on in the morning. if anybody understands IE please let me know!!
PS: if I missed any vital bits of code you need to understand what on earth I'm on about, please let me know.

Terra :(!]

 
Old September 2nd, 2005, 07:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

More copy-paste. How lovely!

Quote:
quote:in Firefox of course it works fine
Maybe it does on your screen with your settings. It doesn't on mine. At least not the snip you posted doesn't. Change your text size and see what happens.

http://yupapa.com
 
Old September 3rd, 2005, 09:06 AM
Registered User
 
Join Date: Aug 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Changing font size doesn't alter problem - I'll try to re-write the way I've done things this weekend & if it works will post update.

Here's also a live version: http://www.wroxham.net/teststuff/menu_problem2.html
I think there might be issues with older Firefox versions - I'm on 1.0.6 and the layering works okay.

PS: not sure what you mean by "copy-paste" ... I thought copying relevant bits of stylesheet is quicker than giving whole stylesheet (all 900 lines of it - I'm redesigning an existing php-based ecom site, so it's a total css mess at the moment - you don't wanna go there, heck I don't wanna go there)

back to work and another day of fighting with IE! Terra ;)

 
Old September 3rd, 2005, 09:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Not font size, text size in the browser. Change it up and down.

--
http://yupapa.com
 
Old September 3rd, 2005, 09:51 AM
Registered User
 
Join Date: Aug 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

amazing what some sleep can do sorry for panicking - I think it's working now. The change I made:

before: z-index property applied to <a class="welcome"> which was nested within <div class="nav">[list]<li>
after: applied z-index property to <div class="nav"> wich contains the whole list

checked in IE6, Firefox 1.0.6 and Opera. gut feeling is that IE6 gave a higher importance to <div class="welcome_bar"> than to <a class="welcome"> despite the z-index command.

working example here: http://www.wroxham.net/teststuff/menu_problem3.html

The button now correctly overlays the border of the image below - yippie! Lesson learnt: don't code CSS when tired ;)

Terra

PS: if anbody wants it, here is the correct code (for HTML see above):
#nav {
    position: absolute; left: 225px; top: 87px;
    margin: 0px; padding: 0px;
    z-index: 20;
}
div.bar_welcome {
    width: 608px;
    height: 14px;
    border-width: 1px 1px 0px 1px; border-style: solid; border-color: rgb(125,113,112);
    margin: 0px; padding: 0px;
    position: absolute; left: 160px; top: 115px;
    background: url('images/bar_welcome.jpg') 0 0 repeat-x;
}

#nav ul li a.welcome {
    margin: 0px; padding: 5px 10px 5px 10px;
    font-size: 13px;
    float: left;
    background: rgb(232,189,77);
}

and thanks belong to "A List Apart" for it's great article on taming lists: http://www.alistapart.com/articles/taminglists/ plus of course Richard's book which is now getting distinctly dog-eared.

 
Old September 3rd, 2005, 10:12 AM
Registered User
 
Join Date: Aug 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Meow - sorry, you're spot on. I had a fixed font-size which is okay for IE but Firefox of course allows you to change fontsize regardless. I've now added a fixed height to the buttons - they change okay for smaller font, but don't look great for bigger fonts.
URL for changed nav is: http://www.wroxham.net/teststuff/menu_problem3.html
Should work now - fingers crossed. Terra





Similar Threads
Thread Thread Starter Forum Replies Last Post
IE6 image background problem nasirmunir CSS Cascading Style Sheets 3 September 2nd, 2008 03:50 AM
problem with my menu in ie6 johnficca CSS Cascading Style Sheets 1 May 6th, 2007 07:41 PM
CSS style issue ok in Firefox but not in IE6 socoolbrewster CSS Cascading Style Sheets 1 September 22nd, 2006 10:01 AM
Layering Architecture used in ASP.NET 2.0 Book alexvasc BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 June 30th, 2006 09:30 AM
Link Display Prob using CSS in IE6 / Firefox socoolbrewster CSS Cascading Style Sheets 3 September 7th, 2005 11:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.