help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help!

i just create a square shape using <div> element.. <div id=square><div> #square { width:100px; height:100px; background-color:gold; } my question is, how to make the square has 2 different color? the square will be divided by half, the top of the square will be colored gold and the bottom is red..

17th Apr 2017, 12:31 PM
miracle
8 Answers
+ 1
direction of gradient, and it's shorter than "to bottom" 😉
17th Apr 2017, 12:49 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
background: linear-gradient(to top, #f00 0%, #f00 49.9%, #ffd700 50%); put your colors
17th Apr 2017, 12:39 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
why there is "to top" in the bracket?
17th Apr 2017, 12:48 PM
miracle
0
i removed it ("to top") and nothing is happen, why?
17th Apr 2017, 1:11 PM
miracle
0
because to top is default value
17th Apr 2017, 1:12 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
btw, how to move the square to bottom? i mean.. i want to move the square to bottom in any value of px (i guess) ..
17th Apr 2017, 1:13 PM
miracle
0
position : fixed; bottom : 0;
17th Apr 2017, 1:16 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
thnx 😊
17th Apr 2017, 1:16 PM
miracle