LoginSignup
0
2

More than 3 years have passed since last update.

CSSで背景を斜めにする。

Last updated at Posted at 2020-09-07

一瞬で背景を斜めにします。
デモ: https://codepen.io/tt113/pen/XWdVGbL?editors=1100

実装

html
<div class="box">

</div>
css
.box {
  height: 600px;
  background: linear-gradient(
    175deg, #fac700 52%, #1394CF 52%);
}

結果

スクリーンショット 2020-09-07 23.26.53.png

解説

cssにはlinear-gradient関数というグラデーションを生成する関数があり、それを使って実装している。

引数の指定方法は様々だが、今回は1つ目の引数(175deg)はグラデーションの角度、

2つ目・3つ目の引数はグラデーションの色、始まる位置を指定している。

参考文献

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