Css 我将如何内联设置此样式?
我如何给#{self.o_cord.name}和#{self.o_product.full_name}一个内联样式,使它们的背景颜色为橙色?它们在一个.rb文件中,我不确定这是否会改变什么。提前谢谢Css 我将如何内联设置此样式?,css,ruby-on-rails,Css,Ruby On Rails,我如何给#{self.o_cord.name}和#{self.o_product.full_name}一个内联样式,使它们的背景颜色为橙色?它们在一个.rb文件中,我不确定这是否会改变什么。提前谢谢 if self.o_connection.dongle? return "Plug the #{self.o_cord.name} end of the #{self.o_product.full_name} into the #{self.i_product.full_name}." 我会
if self.o_connection.dongle?
return "Plug the #{self.o_cord.name} end of the #{self.o_product.full_name} into the #{self.i_product.full_name}."
我会将字符串保留在您的模型之外,而是调用o_connection.dongle?在你看来。然后在您的视图中,您可以简单地通过css将关键字包装成一个范围和样式 视图:
Haml内联css示例:
= f.text_area :short_description, :style =>'background-color:'orange';'
雇员再培训局
背景色:'橙色';'%>
如中所述,要使用哪些选择器和属性?是的,我不确定如何在return语句中使用内联CSS的语法
span.info-label {
background-color: 'orange';
}
= f.text_area :short_description, :style =>'background-color:'orange';'
<%= f.text_field :short_description, :style => 'background-color:'orange';' %>