LoginSignup
0
0

More than 3 years have passed since last update.

RubyとCSSを組み合わせる方法

Last updated at Posted at 2021-03-28

内容

RubyとCSSのコードを組み合わせる方法です。
例えば、カラムの値によってデザイン表示を変えたりということが出来るようになります。
やり方は簡単で記事を見なくてもわかる方が多いと思いますが、やり方が書かれている記事がなかったため記事にしました!

方法

cssファイルにRubyを組み込むのではなく、

HTMLファイルに、下記のように記述

<style>
  .body{
    background-color: #<%=@user.background_color%>;
  }
</style>

HTMLファイルの中の

<style></style>

の中であれば適用されます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0