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 trialShalee Woody
3,956 PointsColor changes
I tried to change the background color in CSS, but the JS runs first before the background changes color, why?
1 Answer
Steven Parker
231,269 PointsYou may be misinterpreting the results.
The CSS should take effect first, but the JavaScript will then run and any changes it makes will be the ones reflected in the rendered document. So any changes made by the CSS will be lost if the same things are also changed by the JavaScript code.
For a more thorough analysis be sure to post your (properly formatted) code or provide a link to a workspace snapshot.
Ella Ruokokoski
20,881 PointsElla Ruokokoski
20,881 PointsPlease post your code