General discussion

Locked

CSS or Javascript or ....

By Allan.Thompson@ntlworld ·
So, what do folk recommend for menu creation on web sites?
I usually use javascript tree style menus but the recent article on CSS has me thinking that this might be a better option.
One problem with Javascript, I believe, is that the user has to enable javascript use on their machines.
On the other hand CSS is only usable on fairly recent versions of browsers.
Is that a fair summary?
What do people think?

This conversation is currently closed to new comments.

41 total posts (Page 1 of 5)   01 | 02 | 03 | 04 | 05   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

CSS has been usable for ages.

by Tony Hopkinson In reply to CSS or Javascript or ....

CSS2 to 3, some browsers didn't implement it all, some of them implemented it differently.
There are still annoying differences on some bits.

Javascript should always be your last option, It's buggy, hard to maintain and relies on client side execution which is becoming more and more of a non starter as browser security becomes more of a public topic.

Collapse -

css as much as possible.

by DanLM In reply to CSS or Javascript or ....

I have all this fancy software that can map my web site off the menu's/links. Well, it doesn't read javascript. I also don't think that the search engine bots can either for indexing all your pages.

css does not hinder either. Also, if you ever watch a page with javascript menu's load compared to css. css will win every time, it's faster. Read all kinds of articles on that one, and also see it in action.

You can get the same look from css. Unfortionally, I don't do web pages that often. So, it's always a new lesson every time I use css. I just don't remember the exacts when it gets that involved.

Dan

Collapse -

CSS all the way!

by wondrouswebs In reply to CSS or Javascript or ....

Use CSS. I like Javascript and use it where appropriate, but I try to never use it where functionality is concerned. Rotating images - sure; menus - never. You can do rollovers with CSS that perform beautifully, you can keep your menu button images to a minimum (if you use them at all; not really necessary unless you are getting fancy), and you will be more in keeping with Web standards. CSS rules.

Collapse -

never, ever CSS for controlling the menus, just styling them

by pixelsurge In reply to CSS or Javascript or ....

If you care about accessibility and usability in the slightest, never use CSS for controlling the menus. Always use JavaScript. This is what it is designed for. Keep the CSS restricted to styling the semantic markup that JavaScript controls the behavior of. For a great summary of my rationale, please see http://www.wait-till-i.com/index.php?p=327.

Collapse -

I question your reasoning

by DanLM In reply to never, ever CSS for contr ...

And not to be a smart a$$, but because I truly do not agree.

Javascript is disabled on a lot of browsers due to security issues. I would put money that more people disable Javascript because of this, then would CSS.

If I was to want to implement a technology that is more accessible, i would think that CSS is the better way.

And that is why I would use CSS over javascript, even in menu's. I think it is turned on more often then Javascript. And then you have the added benefits that it will load faster and the search engine bots can read it easier.

Dan

Collapse -

turn off css?

by Jaqui In reply to I question your reasoning

how?
it's built into the html rendering engine.
you cannot disable css at all and have a functioning browser.

note:
if you use a browser that never had css support, such as lynx, this whole question is moot, no css or javascript in lynx.

Collapse -

please read the article I cited

by pixelsurge In reply to I question your reasoning

It seems obvious that no one read the article I cited, which explains all the accessibility problems with CSS menus. Either that, or you're willing to accept those problems and accept that a significant portion of your audience won't be able to navigate your site, which is your choice, but not one I agree with.

Your logic seems to be that it is better for, let's say 10% of the users to have to use a static menu (because any decent JS menu will gracefully degrade to a static menu when JS is not available) than for let's say 2% of the users to not be able to navigate the site at all. I have the opposite view. Yes, I agree that it is more likely that JS is disabled than CSS is disabled. But that's only a tiny part of the equation. If you are a keyboard user, you cannot use a CSS menu, period. There's no graceful degradation for these users. There's no way to make a CSS menu work for people who have slightly shaky hands or poor motor skills and can't follow the precise movements needed by CSS menus. There's no way to make a CSS menu work for people with small screens when the menus extend off the screen. Etc.

The bottom line is this: The only advantage that anyone can cite for CSS menus over JS menus is that it is more likely that CSS is available than JS is available. To me, this advantage entirely misses the point. The point is that even without JS, JS menus are usable because they can degrade to regular menus. CSS menus can degrade to regular lists when CSS is not available, but the more common scenario is that CSS is available but a disability or limitation on the part of the user makes them unusable. CSS menus are never going to be usable by 100% of the users, period, while JS menus can be. I'd much rather have 100% of my audience able to navigate my site, even if some of them have to use a regular menu. You may choose to ignore part of your audience and go for, let's say 95% accessibility, but I think that's extremely unwise when 100% accessibility is possible.

I think that makes my reasoning very clear. I value accessibility, and use techniques that maximize it.

Collapse -

Link doesnt work

by ron_conaway In reply to please read the article I ...

The link for the article you reference returns an error:
"Error establishing a database connection! This probably means that the connection information in your wp-config.php file is incorrect. Double check it and try again.

Are you sure you have the correct user/password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running? "

Collapse -

Link worx + comments re linked article

by alanholm In reply to Link doesnt work

<p>But there are alternatives 2 JS (besides PHP, PERL etc).</p>
<p> </p>
<p>Problem with JS is it worx Client-side, so, it doesn't exist if JS isn't enabled or available on the client bowser.</p>
<p> </p>
<p>Server-side ASP allows JS equivilant conditional stuff - even using JS if desired (& include files to enable 1 navigation section 2 b included on all pages throughout a Web site) to add 2 what CSS can manage - conditionally highlighting current page in navigation etc. to improve usability - CSS can change the appearance of already visited navigation to also improve usability - navigation should always indicate not only where you can go to, but also where u r & where u've already been.</p>
<p> </p>
<p>Also, <a href="http://www.cssplay.co.uk/accesskeys.htm">http://www.cssplay.co.uk/accesskeys.html</a> shows how accessibility can be supported for users using screen readers.</p>
<p> </p>
<p>If u browse <a href="http://www.cssplay.co.uk/">cssplay.co.uk</a> u'll be amazed by what CSS can do WITHOUT ANY JS!</p>
<p> </p>
<p><a href="http://www.csszengarden.com/">CSS ZEN GARDEN</a> has some eye-popping demos of the power of CSS 2 totally transform identical content 2.</p>

Collapse -

value accessability

by Jaqui In reply to please read the article I ...

and use javascript?
a contradiction in terms.

javascript = non accessable.

btw, I use css menus and I use a keyboard only navigating browser by choice.
guess what, css menus work just fine, since any keyboard only browser doesn't render the STYLING of the xhtml links that make the menu. it does render the links.
you argument against css is completely spurious.

Back to Browser Forum
41 total posts (Page 1 of 5)   01 | 02 | 03 | 04 | 05   Next

Related Discussions

Related Forums