How to add a gradient background color

There are three different gradient types – linear, radial and conic. Gradient backgrounds consist of minimum two colors…

background-image: type(direction, color1, color2, ...);

First we have to choose the type – linear, radial or conic. Next we need to choose the direction. This could be left to right, top to bottom, 45deg (degree) etc. The last step is to define the colors we need.

background-image: linear-gradient(90deg, #6d1677, #000000);

In this example we have chosen a linear gradient turned 90 degrees with colors purple to black.

We could also add a third color making it transform from purple to black and back to purple like this…

background-image: linear-gradient(90deg, #6d1677, #000000, #6d1677);

  Written by: Michael from Beginnrtuts.com     25-10-2022     Written in: CSS tutorials

6 Comments

  • Olivia says:

    Gradient backgrounds are great. I can recommend learning this if you develop a website.

  • Evan says:

    This tutorial was incredibly helpful! I’ve always wanted to know how to add a gradient background color to my website, and this step-by-step guide made it so easy to understand . The explanations were clear, and the screenshots were a nice touch to visually guide me through the process. Now my website looks so much more vibrant and professional. Thank you for sharing such valuable content!

  • Gavin says:

    This tutorial was so helpful! I’ve always wanted to add a gradient background color to my website, but I had no idea where to start . The step-by-step instructions made it super easy to follow along, and the screenshots really helped me understand what each code snippet was doing. I can’t wait to experiment with different gradients now and make my website look even more stylish. Thank you so much for sharing this tutorial!

  • Nolan says:

    This tutorial was incredibly helpful! I’ve always wanted to know how to add a gradient background color to my website, and this article explained it perfectly . The step-by-step instructions were easy to follow, and the screenshots provided visual clarity. Now, thanks to this tutorial, I can create stunning gradient backgrounds for my webpages. Thank you so much for sharing this valuable information!

  • Leonardo says:

    This tutorial was extremely helpful! I always struggled with adding a gradient background color to my website, but the step-by-step instructions and screenshots made it so easy to follow along . The explanation of different gradient types and how to customize them to suit my design needs was fantastic. Now my website looks more vibrant and professional thanks to the gradient background. Thank you for sharing this valuable information!

  • Luke says:

    This tutorial was so helpful! I never knew it was so easy to add a gradient background color to my website . Can’t wait to try it out on my own site. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *