Rails 3: What CSS styles are expected by Rails?
I am creating开发者_开发知识库 a custom CSS stylesheet for a Rails 3 application.
Is there a list anywhere of the CSS styles that Rails relies upon? So far I have found:
- #notice
- #error_explanation
- .field_with_errors
Many thanks.
The css for the flash-messages you can choose yourself, as they are normally defined in application.html.erb
(there is no default definition for flash-messages in rails 3).
For form-styling i would recommend using a gem like formtastic, which not only greatly simplifies making forms, but also provides a standard css file. So all needed tags are then known (and can be overwritten if needed).
If on the other hand you are looking at ways to get your complete layout started quickly, you might want to checkout web-app-theme or activo (which is even more complete).
A fresh Rails 3 app will not require any specific CSS class/id styles beyond the three you just mentioned, which is why no default stylesheet is generated until you start scaffolding.
If you run script/rails generate scaffold MyModel
it will create a stylesheet called scaffold.css
which the generated views will rely upon.
精彩评论