Reputation: 63
I have the below HTML code and I want a gradient block. But the gradient is not rendering on browser.
div {
height: 10px;
background-color: linear-gradient(to right, #cc0099, #ff9933, #ff3399);
}
<div>hi</div>
Can you please tell me what the issue is.
Thanks in Advance, Nikhila
Upvotes: 0
Views: 7336
Reputation: 1
linear-gradient
should be used along with the height
.
background: linear-gradient(120deg,#2980b9,#8e44ad);
height: 100vh;
Upvotes: 0
Reputation: 355
Please change the background-color
to background
to make the code affected.
div {
height: 100px;
width: 100px;
display: block;
background: linear-gradient(to right, #cc0099, #ff9933, #ff3399);
}
Upvotes: 3
Reputation: 1341
linear-gradient
should be used in background-image
div {
height: 10px;
background-image: linear-gradient(to right, #cc0099, #ff9933, #ff3399);
}
Upvotes: 1
Reputation: 56773
It has to be background-image
, not background-color
, for gradients.
div {
background-image: linear-gradient(to right, #cc0099, #ff9933, #ff3399);
}
<div>hi</div>
Upvotes: 5