简体   繁体   中英

Rails 4 - Simple Form with Bootstrap

How do you set alternative CSS for simple form labels. The default is black bold. I want to change the font and weight. I can't see anything in the config files for either simple form or simple form bootstrap to do this. Is there a way to change the config?

Simplest way is to add css in application.css ,

label{
font-family: sans-serif,
font-weight: normal
}

Or else you can create a new stylesheet under app/assets/stylesheets/ folder, for eg- custom.css , app/assets/stylesheets /custom.css -

label{
    font-family: sans-serif,
    font-weight: normal
    }

Add this line to enable rails see your css, config/initializers/assets.rb -

Rails.application.config.assets.precompile += %w( *.css )

and include it in your layout file or on any page like this below bootstrap.css :

<%= stylesheet_link_tag "custom.css" %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM