Having a problem with z-index on the following site:
On the navigation, the arrow belowis meant to appear in front of the blue box below, but it is sitting behind. I tried making #nav as a higher z-index, but then the nav bg block is in front of the text
<div id="nav" class="right30"><ul class="menu" id="nav"><li id="current" class="active item1"><a href="http://portsmouthels.co.uk/new/"><span>Home</span></a></li><li class="item167"><a href="/new/courses.html"><span>Courses</span></a></li><li class="item168"><a href="/new/fees-and-dates.html"><span>Fees and Dates</span></a></li><li class="item169"><a href="/new/accommodation.html"><span>Accommodation</span></a></li><li class="item170"><a href="http://demo.wsxebp.co.uk" target="_blank"><span>Site Demo</span></a></li><li class="item197"><a href="/new/about-us.html"><span>about us</span></a></li></ul></div>
<br class="clear" />
<div id="feature">
<!--hp only-->
<div id="hp-feat-left">
<img id="logo" src="/new/templates/pels/images/logo.gif" alt="Portsmouth English Language School Logo" />
<p id="broc-link"><a href="#">Download Brochure</a></p>
<p class="h1"><strong>Portsmouth English Language School</strong> offers the highest quality teaching as standard.</p>
<p id="feat-hp-intro">PELS is a warm, welcoming school. It has been set up, organized and developed with the emphasis on an outstanding and memorable educational and cultural experience tailored to you, the student.<br />
<a href="#">Register your interest</a> | <a href="#">Book a course</a></p>
</div>
<div id="hp-feat-right">
<img id="slider" src="/new/templates/pels/images/TEMP_feature.png" alt="" />
</div>
</div>
The arrow isnât sitting behind anything. Just move the blue box down and you will see that it doesnât appear.
You are trying to position the arrow outside the element it is contained in which is not possible as nothing can show outside of an element. The anchor needs to be high enough to hold the arrow at the bottom (about 36px) but will need a revision of the code.
Probably easier to apply the image to a nested span and absolutely position it into place.
Note that in FF3.5 your last menu item drops to a new line so reduce the margins a bit so it can fit.
Thank you for looking for me, I will try the nested span⌠should the code go like this?
<li><a href="#">Homepage</a><span></span></li>
Also, if I poition it absolute, presumably I wonât be able to position it centrally as the width of the list element will differ depending on how long the text is?
Hi Paul, I am having difficulties with your example, the problem is that the arrow appears in the middle of the #nav element instead of the list element.
What I was hoping for was that when the nav list element had an id of current. the arrow would appear in the middle below that particular nav item.
So for example, on this page, the nav item âIf you see this itâs Inactiveâ should ideally have the arrow below and in the center, but it is showing 50% into the nav element.
Do you know how I could possibly fix this?
Many thanks for all your help.
Here is the code I have used following your help above:
HTML
<div id="nav">
<ul class="menu" id="nav">
<li id="current" class="active item1"><a href="http://localhost:8888/pels/">IF YOU SEE THIS IT's INACTIVE</a><span></span></li>
<li class="item167"><a href="/pels/courses.html">Courses</a><span class="arrow"></span></li>
<li class="item168"><a href="/pels/fees-and-dates.html">Fees and Dates</a><span class="arrow"></span></li>
<li class="item169"><a href="/pels/accommodation.html">Accommodation</a><span class="arrow"></span></li>
<li class="item170"><a href="http://demo.wsxebp.co.uk" target="_blank">Why Choose Us</a><span class="arrow"></span></li>
</ul>
</div>
Look at my example and you can see itâs working as you required.
You didnât float the list element and you didnât set a stacking context for the absolutely posiioned arrow either. You must set position:relative on the list element and for IE that element also needs to have haslayout which is why I floated it in my example