Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Objects Loop Through Objects Display an Array of Objects on the Page – One Solution

what is the difference between using javascript and css to display content on a webpage?

if it looks like you can use css to display the same content javascript does. why is javascript necessary?

1 Answer

Steven Parker
Steven Parker
231,248 Points

While there's certainly some overlap in capabilities, ideally HTML should be used to create the structure and content of a web page, CSS should handle the styling and appearance, and JavaScript would be used to create functionality.

Now with modern CSS, concepts like transitions and animations overlap both styling and functionality categories, but generally anything that can be done in CSS will operate more efficiently (and appear smoother on the screen) than when implemented in JavaScript.