LoginSignup
1
1

More than 5 years have passed since last update.

background: url(path);にダブルクォーテーションがつく

Posted at

Stylusでbackground: url(path)書くと勝手にダブルクォーテーションつくヤツ。
個人的にパスを記述するときにダブルクォーテーションで囲うようにしてなかったので、なんとなく気持ち悪い。

stylus
#qiita
  background url(img/qiita.png)
css
/*出力結果*/
#qiita {
  background: url("img/qiita.png");
}

公式のドキュメントを見ても特になさそうだったけど、前回(StylusでOldなIEにも対応したOpacity)の応用で出来た。

stylus
bgImageURL(src)
  unquote('url(' + s + ')')

#qiita
  background bgImageURL(img/qiita.png)
css
/*出力結果*/
#qiita {
  background: url(img/qiita.png);
}
1
1
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
1
1