1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00
Files
til/css/style-a-background-with-a-linear-gradient.md

948 B

Style A Background With A Linear Gradient

The linear-gradient function in its simplest form can be used to style the background of an element with a vertical, linear gradient between two colors.

See the Pen pQpypW by Josh Branchaud (@jbranchaud) on CodePen.

<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

Here is what the CSS looks like:

.container {
  background: linear-gradient(#00449e, #e66465);
}

The background of any element with the container class will be styled with a linear gradient that transitions from #00449e to #e66465.