/    Sign up×
Community /Pin to ProfileBookmark

ul sub-menu issue in ie

Hi.
I was wondering if anyone could help me out.

I have a vertical menu which has child menu items, which i have created using unordered lists.
It is not a drop down menu, when a main menu item is clicked, the sub menu items appear (through php coding).

When viewing the menu in firefox and safari its fine, however in IE (7) the sub menu <ul> appears with a text sized gap above it.

[B]my code(XHTML 1.0 Transitional) is:[/B]

<ul id=”left-nav”>
<li class=”main-nav”><a class=”active” href=”#”>Engine &amp; Exhaust</a></li>
<li class=”sub-menu-containing-list-item”>
<ul class=”left-sub-nav”>
<li class=”sub-nav”><a class=”subcategory_active” href=”#”>Product Overview</a>
</li><li class=”sub-nav”><a class=”subcategory” href=”#”>Air Filtration</a>
</li><li class=”sub-nav”><a class=”subcategory” href=”#”>Lube/Fuel/Coolant</a>
</li><li class=”sub-nav”><a class=”subcategory” href=”#”>Hydraulic Filtration</a></li>
</ul></li>

<li class=”main-nav”><a class=”” href=”#”>Dust, Fume &amp; Mist</a></li>
<li class=”main-nav”><a class=”” href=”#”>Industrial Hydraulics</a></li>
</ul>

[B]my css is:[/B]

li.sub-menu-containing-list-item {
background-image:url(../images/bg-side-sub-nav.gif);
list-style:none;
vertical-align:top;
padding-top:0;
margin-top:0;
}

li.main-nav a
{
text-decoration:none;
color:#373636;
}

.left-sub-nav {
text-indent:none;
padding:0;
margin:0;
display:block;
vertical-align:top;
}

.sub-nav {
background-image:url(../images/bg-side-sub-nav.gif);
list-style:none;
width:136px;
display:block;
padding-left:10px;
padding-top:3px;
padding-bottom:3px;
margin:0;
}

.left-sub-nav {
text-indent:none;
padding:0;
margin:0;
display:block;
vertical-align:top;
}

a.subcategory, a.subcategory:visited, a.subcategory:active
{
text-decoration:none;
color:#007fae;
}

a.subcategory:hover
{
color:#003f56;
}
a.subcategory_active
{
text-decoration:none;
color:#003f56;
}
.main-nav
{
background-image:url(../images/bg-nav.gif);
list-style:none;
width:136px;
height:18px;
display:block;
padding-left:10px;
}

.main-nav:hover
{
background-image:url(../images/bg-side-nav-over.gif);
list-style:none;
width:136px;
height:18px;
display:block;
padding-left:10px;
}

any ideas would be most appreciated!
thanx ?

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@CentauriNov 07.2007 — The thing I don't understand with your code is the submenu should be a submenu of [I]something[/I] - at the moment, the parent <li> is blank, and IE is reserving the space for a descriptor here whilst FF is collapsing it. Whether either implementation is correct or not, it doesn't make much sense to me not to have a description that the submenu refers to.
Copy linkTweet thisAlerts:
@katiamauthorNov 07.2007 — Hi Centauri, thank you for your reply.

You are right in your observation, the only reason I did it this way was that it was the closest I could get the menu to be working in all browsers.

I have since realised that because I am not using javascript to toggle on and off the sub menus (they are created when a parent page is accessed through php), I can simple just add the sub menu list items into the parent list, with a different class applied (and remove all child menu thingies).

Which I did, and it works. Simple. So simple I feel stupid for trying it other ways.

thanx again.
×

Success!

Help @katiam spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...