Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

styling css in RoR

when i try to style the homepage of a project i have no problem. when i try to link a different stylesheet to a different page on the website, it still carries the homepage style. i have confirmed i have correctly linked the pages together.

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

All your pages use the default applications.html.erb layout, which in turn carries all the css that you put into assets directory. You need to create different layout files and then render them for specific controllers or actions in those controllers. This link is quite old, but should work, at least it did for me:

http://stackoverflow.com/questions/8465411/how-to-assign-different-stylesheets-in-a-rails-project