2020年4月7日火曜日

CSSシミュレータ(background-image:linear-gradient())

【使い方】textareaの中身(値)を書き換えて色々と試してみる サンプル / linear-gradient サンプル / repeating-linear-gradient

①方向
 上へ / to top = 0deg
 右へ / to right = 90deg = -270deg
 下へ / to bottom = 180deg = -180deg (初期値)
 左へ / to left = 270deg = -90deg
 右上(対角線)へ / to top right
 右下(対角線)へ / to bottom right
 左下(対角線)へ / to bottom left
 左上(対角線)へ / to top left

②位置と色 / 位置はpxか%で指定。色はカラーネーム、カラーコード、RGB、RGBAで指定
 1カ所に1色指定すれば、境界線がグラデーション
 1カ所に2色指定すれば、境界線がくっきり
 続けて同じ色を指定すれば、べた塗り
 位置を指定しなければ、等分(指定数-1)

③画像の繰り返し表示 / background-repeat
 no-repeat / 1回限り、繰り返しなし
 repeat / 縦横両方向に繰り返し
 repeat-x / 横方向に繰り返し
 repeat-y / 縦方向に繰り返し

④背景の表示領域 / background-clip(background-colorで確認すればわかりやすい)
 border-box / borderとpaddingを含む領域に表示
 padding-box / borderを除きpaddingを含む領域に表示
 content-box / borderとpaddingを除く領域に表示

⑤画像の表示起点 / background-origin
 padding-box / borderを除きpaddingを含む領域の左上が起点
 border-box / borderとpaddingを含む領域の左上が起点
 content-box / borderとpaddingを除く領域の左上が起点

HTML

JavaScript