In html how can our webpage contain two different background colours. For example, blue at top half and red at remaining | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In html how can our webpage contain two different background colours. For example, blue at top half and red at remaining

18th Sep 2017, 4:21 PM
Siddhant Poddar
2 Answers
+ 3
https://code.sololearn.com/W8eJyF4MPN7g/?ref=app you can't in html but with css you can. linear-gradient property does it for you! ☝☝
18th Sep 2017, 4:30 PM
I Am RG
I Am RG - avatar
+ 1
If you want 2 solid background colors, just add below CSS: body { margin: 0; padding: 0; height: 100vh; background-image: linear-gradient(to bottom, red, red 50%, blue 50%); } https://code.sololearn.com/WZ99xIj5Hxnq/?ref=app
19th Sep 2017, 12:58 AM
Calviղ
Calviղ - avatar