How to move a circular radial gradient a little up?

How can I move the radial gradient a little higher up while maintaining the same circular width and height?

div {
  line-height: 100px;  
  text-align: center;
  color: #333;  
  width: 100%;
  background: radial-gradient(ellipse 115px 102px, #fff, #516e8e);
}
<div>text</div>
Run codeHide result

I found this solution, but then the gradient is stretched.

background: radial-gradient(at top,red,yellow,green);

Here is the Codepen .

+4
source share
1 answer

Determine the position of the gradient using atas follows:

radial-gradient(115px 102px at center top, #90aed0, #516e8e)

You can use keywords, pxor %to determine the position of a figure:

.box-2 {
  background: radial-gradient(115px 102px at center top, #90aed0, #516e8e);
}

.box {
  line-height: 100px;  
  text-align: center;
  color: #fff;  
  width: 100%;
}
<p class="box box-2">text</p>
Run codeHide result

Note. . Since you determined a specific size, i.e. 115px 102pxtherefore there is no need to use the keyword ellipseor circle.

+3

Source: https://habr.com/ru/post/1674811/


All Articles