Why CSS and not JavaScript?
Hi
I recently visited this site where I picked up some very good CSS tips. In this site the author of these tips states "I try to keep pure and avoid JavaScript". And all over the Web I see sites that tout the virtues of pure CSS. So my question is why. Do most of you think CSS is better than JavaScript, why and when is it better than JavaScript. I am trying to learn things well but I need some guidance in this regard.
Sincerely
Marc
Busy posted this at 23:44 — 22nd April 2006.
He has: 6,151 posts
Joined: May 2001
CSS is (99%) browser friendly, usually pleasing on the eye
Javascript can be disabled in any web browser, so for things like validation, forms etc it's not full proof, for effects like when you mouse over an image CSS uses less code and images in most cases so loads faster.
Everything has it's usefullness and place, CSS for example can't make you a calculator, it can however mould your layout
demonhale posted this at 01:47 — 23rd April 2006.
He has: 3,278 posts
Joined: May 2005
also css was concieved for layout, javascript for active sites... not all browsers are fool-proff with them both, but if some have their javascript support turned-off then you wont see it at all... So use the right tool for the job...
OldWelshGuy posted this at 09:03 — 23rd April 2006.
They have: 64 posts
Joined: Apr 2006
The main problem with Javascript is that the search engine spiders can noy (for the large part) parse them. Up until recently, Google spider (googlebot2.1) was a text only spider capabale of reading text only (it was based on the lynx browser). Now Google do have a spider that can traverse (but not parse yet) javascript. The new browser is mozilla based which gives it more functionality.
If you have valuable parts of your content in javascript, then the search engines are not going to be able to parse it,so you are shooting yourself in the foot. Also it is very easy to create javascript navigation that the spiders can not traverse. In effect you are preventing the spiders from indexing your site.
CSS, DHTML is far better and can achieve a very pleasing and comparable result, and is spider friendly. It also complies with disability regulations.
Internet Marketing Consultancy - My SEO Agony Uncle Blog
steve40 posted this at 20:24 — 24th April 2006.
He has: 490 posts
Joined: May 2005
Java is a dyeing dinosaur, it also is a natural gateway for viruses. Don't use it, IE 7 does not even support any java. The rest will probably follower suit sooner or later.
OldWelshGuy posted this at 20:30 — 24th April 2006.
They have: 64 posts
Joined: Apr 2006
Steve so if IE does not support any Javascripting, how is that Likely to impact on Ajax? Forgive the question as I am not that up on IE.
Megan posted this at 20:35 — 24th April 2006.
She has: 11,421 posts
Joined: Jun 1999
Java is not Javascript. Don't get them mixed up. Java has nothing to do with Ajax.
I'm a little confused by the original question actually. Javascript and CSS are meant for two totally different things. CSS makes things look pretty, Javascript makes things happen (actions, events etc.).
What was the context of that quote? Maybe someone was referring to using Javascript to do things like mouseovers that can be done with CSS (???)
Megan
Connect with us on Facebook!
steve40 posted this at 21:34 — 24th April 2006.
He has: 490 posts
Joined: May 2005
I really don't know about Ajax, I thought that was a household cleanser anyway. All serious, I have heard it's not all it's cracked up to be. Ajax was cooked up by the Black Google, and it's axis of evil to ruin MSN anyway. So I think it is Bill, is not going to support 1 hair of it.
JeevesBond posted this at 22:38 — 24th April 2006.
He has: 3,956 posts
Joined: Jun 2002
You've probably not seen http://www.live.com then Steve. AJAX all over the place, MS are jumping back on the Internet bandwagon again. And yes, it is a household cleaner
As for the original question: I agree with Busy and Megan. The two are entirely seperate things. There are some areas where they cross-over, but generally JavaScript is for "doing things" while CSS is for formatting - to make things look the way you want them to.
Good results can be gained from using the two together, swapping page style sheets for a different look and feel is a good example, or change the styling of a single element (to change a border color or background dynamically for instance).
a Padded Cell our articles site!
demonhale posted this at 03:24 — 25th April 2006.
He has: 3,278 posts
Joined: May 2005
Actually Read my post, and as I said before and explained a little bit its two different things...
SO if you want to discuss about AJAX, theres an AJAX thread already...
javascript is a script...
java is from SUN and a programming language with its own plugin...
AJAX uses most of the time a PHP and Javascipt(js) Combo... and for MS they have there own before the JSscript, almost the same as javascript...
and I hope were not hijacking the thread...
OldWelshGuy posted this at 08:17 — 25th April 2006.
They have: 64 posts
Joined: Apr 2006
Demonhale, I know Java and JS are different but let it go when Steve mentioned it, I assumed he was referring to JS, hence the question. I should have stuck to the age old addage 'NEVER assume'
The only crossover I could see between CSS & JS was in menu creation etc, which was why I commented on it.
As for Ajax being old hat, the only competition to it (and it is not really competition) is RUBY on RAILS. Only glanced at this, but it sure is powerfull, and FAR easier to script than AJAX (it doesn't do much to the kitchen surface cleanliness though)
Internet Marketing Consultancy - My SEO Agony Uncle Blog
Megan posted this at 16:31 — 25th April 2006.
She has: 11,421 posts
Joined: Jun 1999
Well, actually, one of the reasons why there is so much confusion is because people do use the terms interchangeably when they don't actually understand the difference. If others are to understand that these are very different technologies everyone does need to use the terms correctly.
Also, from what I understand, Ruby on Rails is more of a programming framework, like PHP???? It does happen to be used in connection with AJAX a lot but is not a replacement for it.
See: http://en.wikipedia.org/wiki/Ruby_on_Rails#Ajax_on_Rails
So RoR and Ajax are complementary technologies, not competitive.
Check your facts before you post (not just you, OldWelshGuy, there are three instances in this thread alone. Demonhale said that AJAX uses PHP which it doesn't). And anyone can feel free to correct me if I'm wrong, but I did look it up!
Megan
Connect with us on Facebook!
JeevesBond posted this at 20:47 — 25th April 2006.
He has: 3,956 posts
Joined: Jun 2002
Ouch, you lot are getting yourselves in a right pickle!
Megan is correct. Ruby on Rails is a server-side programming language & web framework. The Ruby part of it is the programming language, the rails bit is the framework it "runs" on (arf, arf can you see what they did there? )
Ruby is not to be confused with the W3C technology of the same name, the W3C version is for: "short runs of text alongside the base text, typically used in East Asian documents to indicate pronunciation or to provide a short annotation." Thought I'd include it as I was confused upon finding a section on "Ruby" on the W3C's site!
By framework we mean there's already a bunch of commands and objects and other programming goodies there ready for me when coding begins. There's no need to code how to output html, for example. It's just a case of using one of the bits of rails (which is already coded in Ruby).
Ruby was created by Yukihiro Matsumoto whereas Rails was created by David Heinemeier Hansson (using Ruby). Hansson is the person who wrote the immensely popular http://www.basecamp.com Basecamp is the first debut of Ruby on Rails. Anyone who has used Basecamp before will be aware that the whole application is oozing with AJAX and piles of Javascript.
JavaScript has been around since the Internet equivalent of the Stone Age. Netscape invented it many years ago, it has been loved and villified for creating annoying effects, flashing boxes, pop-ins etc but now with AJAX it is finding a valid use beyond checking whether you've entered the fields on a form correctly.
AJAX is a group of technologies: Asynchronous JavaScript and XML (or XHTML). There are important differences between Ruby, JavaScript and XML. Ruby is a server-side scripting language: All Ruby code is evaluated and executed by the server. JavaScript is a client-side scripting language: It is evaluated and executed by the client, namely the clients browser (Opera, Firefox etc.). XML/XHTML is a document format, similar to HTML. So you use Ruby (on Rails) to generate XHTML/HTML at the server, send it to the client, where it may be manipulated by JavaScript. This JavaScript manipulation might include sending XML/XHTML messages back and forth to the server containing form information from the client, or information back from the server e.g. successful update of that record. For example:
You have a to-do list in Basecamp open. You create a new to-do item, before AJAX you would have pressed "Submit" (or something along those lines) to submit the form and update the list with your new item. This would have meant the whole page disappearing into the ether, the information being stored in a database, then the whole page being downloaded again. Now, with AJAX, JavaScript sits in the background handling the sending of information back to the server (in the form of XML/XHTML) and recieving the servers response. No page reload. The result is the site looks slick, and appears to be running a lot faster as the page doesn't have to be downloaded in its entirety every time some information is submitted.
I think that just about covers everything. Thought I'd make the answer as comprehensive as possible.
a Padded Cell our articles site!
Megan posted this at 16:28 — 27th April 2006.
She has: 11,421 posts
Joined: Jun 1999
By the way, I hope this doesn't make anyone afraid to post or anything. We do want to make sure that we are posting accurate information here as much as possible. If you're not sure about something, it's okay to say so either directly (I'm not sure, but I think....) or indirectly (using question marks like I did).
Uncertainty can bring a lot of opportunities to learn more
Megan
Connect with us on Facebook!
demonhale posted this at 16:36 — 27th April 2006.
He has: 3,278 posts
Joined: May 2005
Pretty much everything thats posted by jeeves is right, and as a correction for my previous post AJAX should be composed of XML and Javascript, not php and javascript... I was actually thinking of PHP and Ajax is used now most of the time, thats why through the advent of php the evolution of AJAX has been pushed quite faster...
In this light, Yahoo mail beta now has AJAX implementation...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.