1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Bootstrapのボタンの色を増やす方法

Last updated at Posted at 2020-04-26

CDNを使っている方npmまたはyarnを利用してください。

インストール

Bootstrapをインストールしてご利用ください。

$ npm install bootstrap

Scss作成

/scss/style.scss
$qiita: #55c500;

$theme-colors: (
  "qiita": $qiita,
);

@import "../node_modules/bootstrap/scss/bootstrap.scss";

コードはこれだけです。
Gulpなどでコンパイルしてください。

確認

index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Bootstrap Qiita</title>
<link rel="stylesheet" href="./css/style.css">
</head>
<body>

<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-qiita">Qiita</button>

</body>
</html>

これで新たにbtn-qiitaが追加されていることが確認できます。
badge-qiitaも追加されてたりします。

注意点として、btn-qiita分コードが増えるので、容量も増えます。
ほどほどでどうぞ。
逆に削ることも出来るので開発、実行環境とご相談ください。

以上

npm等でインストールすると、CDNでBootstrapを利用することがなくなるぐらい便利になります。
よっぽどの理由がない限りCDNの利用は避けたほうが吉です。

1
3
1

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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?