user3398379
user3398379

Reputation: 83

how to add gradient color to background in div

hi i want to add gradient color to my div's background.. I tried this code but it's not working

#apple {
  background: #0E5D7B;
  /* For browsers that do not support gradients */
  background: -webkit-linear-gradient(white, #0E5D7B);
  /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(white, #0E5D7B);
  /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(white, #0E5D7B);
  /* For Firefox 3.6 to 15 */
  background: linear-gradient(white, #0E5D7B);
  /* Standard syntax */
}
<div id="apple" style="height: 300px;width:auto;background-color:	 #0E5D7B; margin-top: 0px;">
</div>

please tell me how to fix this

Upvotes: 2

Views: 6553

Answers (2)

Razia sultana
Razia sultana

Reputation: 2211


#apple{
    height: 300px;
    width:auto;
    background-color:#0E5D7B;
    margin-top: 0px;
    background:linear-gradient(white, lightblue);
}

<div id="apple">
</div>

Upvotes: 2

Niall Walker
Niall Walker

Reputation: 185

Just fyi, you're missing the class selector (a dot). For a class you use a dot, # for an id. Hope this helps

Upvotes: 0

Related Questions