Treehouse: Grow your CSS skills. Land your dream job.

Jquery vs CSS

  • # June 22, 2011 at 1:11 pm

    I have spent many years slowly picking up tips and tricks for using CSS and although I’m not a very active web developer, I can usually achieve most of what I need with a few google searches.

    This and other sites advocate Jquery as another technology to use, so recently I started an online tutorial, and it looks great. However, I’m becoming rather confused as to when to use JQuery and when to code CSS.

    What is the best approach? When should I use CSS and when does Jquery do best?

    Many thanks

    # June 22, 2011 at 1:45 pm

    Well, the CSS have limitations… Imagine this example: You want to change the font color of a div on hover; here you can use CSS, jquery is for harder thing…

    If you want the same but when hover other individual div you can use jquery.

    Other difference is the support, Javascript is more stable than CSS, but try always to use css when needed. Animations are now part of the CSS, but jquery will work in major browsers.

    # June 23, 2011 at 5:29 am

    Interesting, we discuss design vs. content vs. functionality, but JQuery seems to be being used for both design and functionality and even in some cases changing content!

    Seems to me that the rules are changing.


    # June 23, 2011 at 6:01 am

    Jquery is about function. Whilst you can use it for styling, you’re still really using it as a “function”, for example you might use Jquery for a menu. That may be a style thing but predominantly you’re doing it for function. CSS on the other hand is purely about styling the page.

    I do believe however in the future it’s possible a language will be developed that does both jobs. Things like CSS3 transitions are already changing the way CSS is used.

    # June 23, 2011 at 7:06 am
    .element:before {
    content: 'this is a style which inserts content...';

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.