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

CSS

Jonathan Loiacono
Jonathan Loiacono
1,078 Points

CSS won't be read by html page in "updating the index page" project

So I have had some problems before with my css file not being read by my index.html. I have read and tried a couple things but nothing seems to be working.

Here is my index.html.erb:

<div class="page-header"> <h1> All of the Statuses </h1> </div>

<% @statuses.each do |status| %> <div class="Status"> <strong><%= status.name %></strong> <p><%= status.content %></p> <div class="meta"> <%= link_to time_ago_in_words(status.created_at) + " ago", status %> <span class="admin"> | <%= link_to "edit" , edit_status_path(status) %> |<%= link_to "Delete" , status, method: :delete, data: { confirm: "Are you sure want to delete?!"} %> </span> </div> </div>

(note* i have <span class="admin" there, i am not sure as to why it may not work)

Here is my statuses.css.css file: .status { border-bottom: solid 1 px #ccc; padding: 5px 0; }

.status p { margin: 4px 0; }

.status .admin { display: none;}

.status.hover .admin { display: inline; }

I have been sure to save it constantly, and checked to make sure the saved file was updated in the folder. If anyone can help me understand why my html file is not taking the css file i would greatly appreciate it! Thanks!

Cheers

1 Answer

My first suggestion would be to verify your pointing to the file correctly in your directory. I would inspect the page in the browser and see how the CSS page is being loaded. From there you should be able to correct it once you know where it is hanging up at.

Jonathan Loiacono
Jonathan Loiacono
1,078 Points

Hey Dave!

Thanks for the response! So, I am pretty sure the CSS file is where it is suppose to be, and upon a "Quick look" everything seems like its right. My file is under Jayleo243/treebook/app/assets/stylesheets/statuses.css.css. Which is also how it loads up.

I am fairly new to this but had this problem before. The only thing I know for sure is that it is definitely saving to the correct spot (or what I think is the correct spot). Any other ideas as to how to get the link between the html sheet and the css sheet to link up?

Thanks again!