Forums | MacLife

You are not logged in.

#1 2006-03-21 3:05 pm

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

css UL menu and ie

I'm reworking a site, trying to bring it to the 21st century and use css only in it.
Pretty simple stuff, including a simple menu using UL .. I tried using display:online , as well as float:left ...
I'm also floating the a tags....
anyway, works great on safari and firefox on the mac and even on ie on the mac. However ie on the pc simply display the menu vertically

CSS

Code:

    .menu    {color: #000066;
            float: left;
            margin-right: 1.2em;
            font-size: small;
            }
    #menubox {
            position: absolute;
            width: 98%;
            top: 90px;
            margin-left: 5px;}
    a.menu        {text-decoration: none;}
    .active    {color: #ffffff;
            float: left;
            margin-right: 1.2em;
            font-size: small;
            }
    a.menu:hover {color: #ffffff;}
    a.active , a.active:hover 
            {color: red;
            text-decoration: none;
            background-color: transparent;}
    ul        {list-style: none;
            margin: 0;
                    display: inline;
            padding: 0;
}

HTML

Code:

<div id=menubox>
<ul>
    <li><a class="menu" href='new.php?lang=english&page=act' >Shows</a></li>
    <li><a class="menu" href='new.php?lang=english&page=video' >Videos</a></li>
    <li><a class="menu" onClick='return clickreturnvalue()' onMouseover="dropdownmenu(this, event, menu2, '100px')" onMouseout="delayhidemenu()" href='pictures.php?land=english'>Photos</a></li>
    <li><a class="menu" href='new.php?lang=english&page=news-clips'>Newspaper Articles</a></li>
    <li><a class="menu" onClick='return clickreturnvalue()' onMouseover="dropdownmenu(this, event, menu1, '80px')" onMouseout="delayhidemenu()" href='resume.php?land=english'>Résumé</a></li>
    <li><a class="menu" href='new.php?lang=english&page=about' >About Fred</a></li>
    <li><a class="menu" href='new.php?lang=english&page=promo' >Flyer</a></li>
    <li><a class=menu href='/index.html' target='_top'>Language Choice</a></li>
    <li><a class="menu" onClick='return clickreturnvalue()' onMouseover="dropdownmenu(this, event, menu3, '80px')" onMouseout="delayhidemenu()" href='personal.php?land=english'>Personal Crap</a></li>
</ul>

site

So what am I doing wrong again?

Danny

Last edited by Redstone (2006-03-21 3:09 pm)


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#2 2006-03-21 5:15 pm

Miles
Now I fight for wisdom!
Administrator
From: Michigan
Registered: 2001-07-21
Posts: 4479
Website

Re: css UL menu and ie

Redstone wrote:

I'm reworking a site, trying to bring it to the 21st century and use css only in it.
Pretty simple stuff, including a simple menu using UL

smile up

Try also floating the <li>s to the left.

Also, if you want to go hog wild (and you do, trust me), you can get rid of most of the JavaScript that drives the drop down menus and make it even more semantic. I'll post more on this later.

Offline

 

#3 2006-03-21 5:24 pm

Miles
Now I fight for wisdom!
Administrator
From: Michigan
Registered: 2001-07-21
Posts: 4479
Website

Re: css UL menu and ie

Also you're gonna want to take the <style> tags out of your CSS file.

Offline

 

#4 2006-03-21 6:14 pm

Miles
Now I fight for wisdom!
Administrator
From: Michigan
Registered: 2001-07-21
Posts: 4479
Website

Re: css UL menu and ie

I haven't worked the bugs out, but you get the idea.

Offline

 

#5 2006-03-22 3:29 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Thanks Miles ,
I'll look into it.
The main reason I used that drop-menu was since it seems to be supported by most browser. I've seen css drop menu but most don't work on IE.


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#6 2006-03-22 7:11 am

Alien
FF
Administrator
From: Republic of Amsterdam
Registered: 1999-07-05
Posts: 16553
Website

Re: css UL menu and ie

The <li> is the menu item, not the <a> enclosed in it.

,xtG
.tsooJ

Offline

 

#7 2006-03-22 11:46 pm

cosmicosmo
Chancellor Mmmm
From: Peninsula, Ohio, US of A
Registered: 2003-02-06
Posts: 235
Website

Re: css UL menu and ie

you shouldn't even need to specify the class of each menu item.  changing '.menu' to '#menubox a' would produce equivalent results.  As alien points out, it'd be better as '#menubox li'.


I hate your wimper

Offline

 

#8 2006-03-23 2:11 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Thanks guys ,
I really thought I tried li float:left already.
The real reason I'm using a class in the a is to be able to change the class when that link is active.

Guess I can move all the other float:left I have in the menu style.

Thanks a lot.


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#9 2006-03-23 6:34 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Miles wrote:

I haven't worked the bugs out, but you get the idea.

Hi Miles , I checked your page on Safari , Firefox and ie5 on my mac and on IE pc .

Of course it doesn't work on ie5 - but lets face it, most thing don't do any more.
It does work on ie pc but doesn't display the bottom border..
I'll look through the code and see if I can figure it out.
Thanks again.

Danny


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#10 2006-03-23 10:01 am

reefdog
Just Quit You
Registered: 2000-05-15
Posts: 10691

Re: css UL menu and ie

Don't bother testing on IE5/Mac, seriously. It's an entirely insignificant browser. You're better off optimizing for WebTV. The only people I run into who still use it are designer types who were smart enough to recognize its value in 2001 but aren't nerdy enough to keep up-to-date. Seriously, unless you've got the audience and budget of a Yahoo, you don't need to bother.

As for your code: apply #menubox directly to the UL (you don't need a wrapper div) and lose the display:inline. Float the LIs, not the links. Set the links to display:block. Get rid of the .menu class, just apply styles to #menubox li a instead. You can still have an active class, because it will override the other definitions.

I learned the method using one of ALA's old designs. The current design might be just as informative, probably more so.


Great apps: Basecamp | Highrise | Backpack

Offline

 

#11 2006-04-01 3:17 pm

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Miles ,
I'm fascinated with the Java script in your css menu.
But it does baffle me :
does the script also recognize browser who wont support css menu this way or doe sit only toggle between the two versions?

If it doesn't recognize, it is infact not really necessary , right?

thanks again , its really simple and classy.

Danny


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#12 2006-04-01 3:35 pm

Miles
Now I fight for wisdom!
Administrator
From: Michigan
Registered: 2001-07-21
Posts: 4479
Website

Re: css UL menu and ie

The toggleStyles script is my own is and simply intended to show how the list looks with and without styling.  It doesn't actually apply any of the styling, and is browser-independent.

The other script (startList), the one that does the magic for IE, is from this ALA article.  It only affects IE (since it tests for the existence of document.all), and all it does is attach event handlers to deal with the list item rollovers (since IE doesn't recognize the :hover pseudoclass on anything except <a> elements).

Offline

 

#13 2006-04-02 3:41 pm

Gipetto
Yankee Doodle's noodle
Royal Wombat
From: People! Ahg!!
Registered: 2000-09-24
Posts: 9937
Website

Re: css UL menu and ie

If you need help with menus you should check this out: http://www.cssplay.co.uk/menus/index.html


So, just when did this place get Private Messages? YIKES!

Gippy Pages  |  Fuzzy Coconut XHTML Widget | PuppyCam

Offline

 

#14 2006-04-03 1:49 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Thanks.
Though I'm happy with miles code, its a cool way to learn much much more about css


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#15 2006-04-03 4:55 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Miles,

Weird problem, using your code, with a little modification on ie-pc , the link after a folder link expand the previous 'folder' .
Though this doesn't happen with your original page. So it most be something I did, but fior the life of me, I still can't find out what it is. I almost didn't change the code.

I'll look into it more, but if you have the time for a quick glance.
URL
thanks


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#16 2006-04-03 10:05 am

Miles
Now I fight for wisdom!
Administrator
From: Michigan
Registered: 2001-07-21
Posts: 4479
Website

Re: css UL menu and ie

Code:

        <li><a class="menu" href='#'>Photos</a>
            <ul>
                <li><a href=?lang=english&page=pictures&page2=press>Press Photos</a></li>
                <li><a href=?lang=english&page=pictures&page2=japan>Japan Photos</a></li>
                <li><a href=?lang=english&page=pictures&page2=VIP> Artist Friends</a></li>
            </ul>
        </li><a class="menu" href='?lang=english&page=news-clips'>Newspaper Articles</a></li>

That last item, Newspaper Articles, has no opening <li>.  Same goes for the items following the other submenus.

I know that validating HTML isn't your number one concern, but it would catch stuff like that.  When your code is valid, you can eliminate differing browser error handling as the source of some weird errors.  I also know that it's a pain in PHP to type \" to get quoted tag attributes, but you really should do it.

Offline

 

#17 2006-04-03 10:56 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Damn ,
I feel so stupid. I actually looked for missing tags, but the
</li> threw me off, I simply chose to ignore the / in that tag.

Thanks, guess I'll take validating a little more seriously now.

Also , I'm not entirely sure how to fix lack of bottom border in ie (same in your page) so I simply have a thick border, by removing the : border-bottom: none;

I'll might look into it more later...

Last edited by Redstone (2006-04-03 10:58 am)


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#18 2006-04-21 6:17 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

hi miles ,

problems with your code and ie - I think ie doesn't know Z-index which means that once there is text or whatever the menu doesn't work .
check out this :
http://dirtyfred.com/new/index.php?link … amp;show=3

Thanks
Danny

Last edited by Redstone (2006-04-22 1:46 am)


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#19 2006-04-21 8:29 am

CurtisS
Que pasa?
From: Kingston, WA USA
Registered: 2004-02-24
Posts: 245
Website

Re: css UL menu and ie

For z-index to work, the item has to have a CSS position:(absolute, relative, etc...)


Ciao for now!

CurtisS

Offline

 

#20 2006-04-21 3:36 pm

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

ok, my mistake. So z-index is not the reason.
The problem is, in IE pc, when there is text where the menu appear, you can't reach parts of the menu.
Any ideas?

thanks

Danny


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#21 2006-04-21 5:17 pm

Miles
Now I fight for wisdom!
Administrator
From: Michigan
Registered: 2001-07-21
Posts: 4479
Website

Re: css UL menu and ie

That link doesn't work anymore.  That being said, on pages like this, the menus work fine for me in IE6/Win.

Offline

 

#22 2006-04-22 1:48 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

sorry - I changed the page name... I edit it and it's working now.
It does work if there is no content under the menu - however once there is content you can see the expanded menu but can reach under the second link..

So, what am I doing wrong...


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#23 2006-04-23 7:45 am

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

seems like I solved it. The problem was, if the div of the content the menu overlapped had a position: relative ; the menu didn't work.
Turned out, I didn't need that at all ..

thanks for the help

Danny


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#24 2006-06-11 4:10 pm

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

Hi Miles, I moved the menu a little, but didn't alter the actual css.
now in IE , there are hugh margins.

Help.

Danny


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

#25 2006-06-11 4:48 pm

Redstone
Member
From: The Blue planet , Belgium
Registered: 2000-12-22
Posts: 679
Website

Re: css UL menu and ie

after slowly going through all the changes, I've found that when I remove the border from #nav il il - IE add these margins. Even if I set the border to 0px margins are still there.

Weird.

Danny


New project : Goddess Of Destruction CD available online
Jingles writers
Check out http://www.darlingnikkie.com to discover the sonic world of Darling Nikkie (aka Jade4U)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson