triskellian: (cartoon me ibook)
[personal profile] triskellian
I mentioned on [livejournal.com profile] secretrebel's journal earlier today that I'd been playing with a new CSS trick. [livejournal.com profile] chrisvenus and [livejournal.com profile] wimble both asked what it was, and I said I'd post the details here.

It's a nice method of making drop-down menus with CSS... I found the technique at A List Apart, but that only worked with two levels of nested menus. I've now fiddled with the stylesheet to make it work with three levels.

The working version is here, and this is the CSS. The 'leftcol' div needs to appear after the 'content' div in the HTML, to make sure that the expanding menus display over the top of the content div.

(To work with IE, the technique requires a teensy bit of Javascript, which is documented on the ALA page. I didn't include it, because I'm working on pages only I will use, and I never use IE.)

Date: 2004-07-06 09:30 pm (UTC)
From: [identity profile] wimble.livejournal.com
Oddly, while the original works fine for me under opera, your version has alignment issues. But it does work fine under Firebird, which I guess is your target audience.

http://mrwolf.afraid.org/~tommy/triskell.jpg

Spot the slight difference in length between items 1.1 and 1.2, and the resulting gap between item 1.2 and the submenu (each top level item gets a touch longer as its submenu appears). And of course, the huge gap before the third level. :-)

I might have a think about why, if I can be bothered. Maybe.

Date: 2004-07-06 09:45 pm (UTC)
From: [identity profile] wimble.livejournal.com
Should now be fixed.
a) Bloody XP/samba. Saved it with a .JPG extension, not .jpg
b) Damn you for checking it about 23 seconds before I confirmed it fixed!

Date: 2004-07-06 09:32 pm (UTC)
From: [identity profile] bateleur.livejournal.com
I take it that the "to work with IE" comment implies that when using IE the page should sit there doing nothing ? That's what it does, anyway.

Date: 2004-07-06 09:46 pm (UTC)
From: [identity profile] wimble.livejournal.com
Hence the which I've not included...

Date: 2004-07-07 09:00 am (UTC)
From: [identity profile] onebyone.livejournal.com
Correct. The problem is that the CSS spec says of the "hover" and "active" dynamic pseudo-classes that "CSS doesn't define which elements may be in the above states, or how the states are entered and left".

IE only allows links to be in the "hover" state (and it's that state which triggers the expanding of the sublist), whereas apparently everyone else in the known universe allows li to be in "hover" too.

Date: 2004-07-06 09:41 pm (UTC)
From: [identity profile] ex-kharin447.livejournal.com
Works fine in Mozilla 1.6.

Date: 2004-07-06 09:43 pm (UTC)
uitlander: (Default)
From: [personal profile] uitlander
Indeed. And I have often wondered how you do that with CSS, so now I know. Thanks!

Date: 2004-07-07 07:55 am (UTC)
chrisvenus: (Default)
From: [personal profile] chrisvenus
shiny! You can tell I've been doing IE stuff too long cos I thought you had to have JS to do that... :)

Date: 2004-07-07 11:16 am (UTC)
chrisvenus: (Default)
From: [personal profile] chrisvenus
I was wondering if you really needed the third level classes to be different but I decided I didn't have time to go playing with the CSS.

Though that does remind me, since you seem to be a CSS whizz would you by any chance know off the top of your head how I can get some stuff to stick to the bottom of my browser window? Basically a table like structure which has "footer" information in it and currently it bounces up and down according to page length so I want to stick it to the bottom of the window if possible. I supect this should be possible with the CSS positioning but I've not played iwth it much and I wondered if you had...

Don't worry about it too much if you can't just say "Oh, yeah, do this." but I thought I should ask rather than spending hours and finding that you could have told me in 2 minutes... :)

April 2013

S M T W T F S
 123456
78910111213
141516171819 20
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 28th, 2026 12:53 am
Powered by Dreamwidth Studios