menu
書いてる野郎
orebike@gmail.com
#hoge{ background-image: url("hoge.png"); background-repeat: no-repeat; background-size: contain; background-position: center top; }
#hoge{ background-image: url("hoge.png"); background-repeat: no-repeat; background-size: cover; background-position: center top; }
#hoge{ background-image: url("hoge.png"); background-repeat: no-repeat; background-size: 100% 100%; background-position: center top; }
#hoge{ background-image: url("hoge.png"); background-repeat: no-repeat; background-size: auto; background-position: center top; }
よくあるのが、グラデーションの背景にさらに背景画像を張り込むというもの。 CSS ではグラデーションの背景は image として扱われるので、つまり複数の背景画像を貼り付ける必要がある
#hoge{ background-image: url("hoge.png"), linear-gradient(to right, green, blue); background-repeat: no-repeat, no-repeat; background-position-x: left calc(((100vw - 900) / 2) + 120px), left;