CSS link to erb


hello Im trying to link a CSS file to a .erb file ive tried putting both

link rel=“stylesheet” type=“text/css” href=“CSS.css”


<%= stylesheet_link_tag “CSS.css” %>

but neither work could someone tell me how.



Where is the CSS file located? Do you have a link to the workspace?





are where the files are located


So I imagine the URL for the files is something like workspace-username.c9users.io/wiki/css.css? In that case, your path should be /wiki/css.css The slash at the beginning says that it is the start of the path, and then the rest is the folder you mentioned. What you are doing right now is simply causing the path where you look for files to be workspace-username.c9users.iocss.css where the lack of a slash simply appends it to the end. This also means if you went on /randompage it would look in /randompagecss.css. This is one of the many relative shortcuts. Another is // which means “this is the beginning of the url”, so you could do //google.com and that would resolve to http://google.com/.


link rel=“stylesheet” type=“text/css” href="/wiki/css.css"

so this should be the right code for the CSS to apply to the erb file right??


Yes, hopefully. If not, can you link me to the workspace or post any errors there are?



the css just doesnt apply currently only trying on the home.erb view


OK, looking at your project, can you move the CSS file into the views folder? I’ll then try to see if I can access it


I have gone ahead and done it