x404.co.uk http://www.x404.co.uk/forum/ |
|
WebKit doesn't display CSS drop down menus correctly http://www.x404.co.uk/forum/viewtopic.php?f=4&t=8526 |
Page 1 of 1 |
Author: | forquare1 [ Fri May 28, 2010 12:26 pm ] |
Post subject: | WebKit doesn't display CSS drop down menus correctly |
Hi all, On my website I have recently run out of room to add more links, so have divided them into several menus. These use CSS as I dislike use JavaScript. In Firefox (and all other Gecko browsers), Opera and Lynx, these look great and work perfectly. However, in WebKit (Safari and Chrome), they don't...The menus appear, but appear as a horizontal menu rather than vertical... The former is the desired effect. But which is the most standards adhering in this process? Has Gecko and Presto been tweeked to allow such breakages of the standards? Or does WebKit just not conform to the standards as much as I'd like? Ben |
Author: | tombolt [ Fri May 28, 2010 4:44 pm ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
Without seeing it, it's hard to say. Could it be something to do with the elements being interpreted as inline rather than block by webkit, so they need to be explicitly set as block elements? |
Author: | big_D [ Sat May 29, 2010 6:29 am ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
Can you post the CSS? I wrote an inventory tracking system, which generated CSS menus and Safari and Chrome worked without any problems on it - it had to, the studio were using Macs and Safari... |
Author: | forquare1 [ Sat May 29, 2010 12:00 pm ] | ||||||||||||||||||
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly | ||||||||||||||||||
It's largely from another site, I'm not sure what most of it is doing, but I seems to work under Gecko and Presto. |
Author: | Nick [ Sat May 29, 2010 11:26 pm ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
That CSS isn't exhaustive, is it? I would guess that you have a top-level <ul></ul> going horizontally along the top, and each <li></li> contains a further <ul></ul> that you want to go vertically? If that's the case, you must have forced the top level <ul></ul> to go horizontal (display:inline;), and I'd guess that the subsequent <ul></ul> elements are inheriting this attribute. Also - how come you are giving some elements an absolute position of 0,0 and also floating them? Surely floating them is enough on it's own? |
Author: | big_D [ Sun May 30, 2010 10:07 am ] | |||||||||
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly | |||||||||
You shouldn't generally mix absolute and relative. All the positioning should be relative. That will often mess things up. I'll have a look and see if I have a copy of my menus knocking around... It was a project for my last employer and it was an internal website... edit: The code is loosely based on a template from Stu Nichols (http://www.cssplay.co.uk/menus/ ). I have modified it a fair bit, but the basic concept comes from. Unfortunately the menu system is generated dynamically from a MySQL database, using PHP, so there isn't any menu html code to see - I don't have a running MAMP server here any more...
|
Author: | Nick [ Sun May 30, 2010 1:04 pm ] | |||||||||
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly | |||||||||
Well yeah, that's the point I was making. This is all guess work without all the markup. Can you host it somewhere and link us, Ben? |
Author: | forquare1 [ Mon May 31, 2010 12:37 pm ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
Sorry, been a bit of a hectic weekend...I've not looked at the menus much since I posted this as I've been working on some other things. The code is pretty much a copy and paste job from a tutorial I found somewhere. It worked fine in Camino, but then when I went to test out some other things, I found that WebKit didn't like it. I've zipped the menu source, the main index page and the CSS files into a file you can download here: http://hashbang0.com/personal/menu.zip I really appreciate your help. I'll have a closer look over the next few days at it myself too. Thanks again, Ben |
Author: | Nick [ Mon May 31, 2010 5:14 pm ] | ||||||||||||||||||
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly | ||||||||||||||||||
Okay, so it turns out to be a problem with floats. I've tested with Chrome and Firefox, and to me the way Chrome handles it is more logical. Not sure about standards - but I would guess Chrome is probably more standard. I don't know why, but for some reason this guy has decided not to use display:inline; and has instead forced the behaviour with float:left; but in doing so, he has forced the behaviour onto both the top level, and the embedded <li></li> elements. This is the problem:
It floats the top level <li></li> elements to force them horizontal, which I suppose is fine (although he should have just used display:inline; for the same effect). The problem is that he has also included the emebedded <li></li> elements. So replace the above code with:
And it now works a treat on both Chrome and Firefox. The default behaviour of a <ul></ul> is to drop <li></li> elements vertically. He chose to over-ride that behaviour with floats, and Firefox only did it to the top level <ul</ul> Moral of the story: use display:inline; instead. ![]() |
Author: | forquare1 [ Mon May 31, 2010 7:40 pm ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
Nick, thanks very much! The changes have been uploaded and it works well on all of the browsers I have access to (all but IE). Thanks very much ![]() |
Author: | Nick [ Mon May 31, 2010 7:58 pm ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
No worries. I'd still suggest scrapping it and using display:inline; though. |
Author: | forquare1 [ Mon May 31, 2010 8:03 pm ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
I'll give it a look over when I get the chance ![]() CSS is one of my least favourite parts of web design, and at the minute, I'm concentrating most of my efforts on a script I've just published as that's more fun ![]() |
Author: | paulzolo [ Thu Jun 03, 2010 10:31 pm ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
I thought you used Freeway, which has CSS menus sorted. |
Author: | forquare1 [ Fri Jun 04, 2010 12:38 am ] | |||||||||
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly | |||||||||
Faye's sire uses Freeway, but I edit mine myself (I like to keep it geeky)... |
Author: | Nick [ Fri Jun 04, 2010 1:25 am ] |
Post subject: | Re: WebKit doesn't display CSS drop down menus correctly |
It's the way things should be, Ben. ![]() |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |