1
0

More than 1 year has passed since last update.

ヘッダーを透明にし、body要素の上に配置する

Posted at

ackground-color: rgba(0, 0, 0, 0);とposition: fixed;を使用してヘッダーを透明にし、body要素の上に配置する

具体的な使い方

header {
    position: fixed;
    background-color: rgba(0, 0, 0, 0);
}

こんな感じになります。
スクリーンショット 2022-03-03 22.54.45.png

結論

1.position: fixed;はヘッダーを固定するプロパティでbody要素に被せるように配置します。スクロールしてもヘッダーは表示されたままになります。
2.background-color: rgba(0, 0, 0, 0);は4番目の値を0~1で透明度を設定でき、0に近ければより透明になります。1、2、3番目の値はbackground-colorを設定する値になります。

1
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
1
0