0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

CSSの変数

Posted at

はじめに

CSSでも変数を使うことができるのでどのように実装するのかメモ

やり方

全体で値を再利用するために、css変数を利用することができる
rootで宣言することが一般的

.css
:root {
	--color-warning: red;
	--color-danger: yellow;
}

.danger {
    /* 背景 */
    background-color: var(--color-danger);
    /* 文字色 */
    color: white;
    /* 文字の太さ */
    font-weight: 700;
    /* 文字の位置 */
    text-align: center;
    /* 文字の大きさ */
    font-size: xx-large;
}
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?