简体   繁体   中英

how to make background color from bright blue to dark blue using css/html/js

im trying to make my website background start as a light blue background color and end up with slightly darker blue.

is there a way to code it? or should i put an image as the background(if no other option)?

here is the image with the exact colors i want my background to have:

please ignore the clouds in the image, and check the colors only.

背景颜色图像

Use a gradient

 main { height: 100vh; background: linear-gradient(skyblue, darkblue); }
 <main></main>

You should use linear-gradient

 .background{ width: 100vw; height: 100vh; background-image: linear-gradient(to bottom, cyan, blue); }
 <div class="background"> </div>

You could try linear-gradient. Click here for more information

See this for more information on which browsers support it: https://caniuse.com/?search=linear-gradient

Here's an example:

 #grad1 { height: 200px; background-color: blue; /* For browsers that do not support gradients */ background-image: linear-gradient(#0000FF, #000044); }
 <div id="grad1"></div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM