0

I am trying to move the left position of the gradient. But it is not working.

Even after adding background-position property, it does not works.

header{
height:100px;
border:1px solid blue;
background: linear-gradient(to top, #e20e0e 50px, #0000 50px);
background-position-x: 50px;
}
<header></header>
Prajwal
  • 3,930
  • 5
  • 24
  • 50
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
  • didn't understood your question :( can you provide some visuals about what you are expecting? – Uttam Aug 21 '21 at 08:12

2 Answers2

2

Turn off background-repeat.

header{
height:100px;
border:1px solid blue;
background: linear-gradient(to top, #e20e0e 50px, #0000 50px);
background-position-x: 50px;
background-repeat: no-repeat;
}
<header></header>
Liftoff
  • 24,717
  • 13
  • 66
  • 119
1

You should add background-repeat: no-repeat; property.

Check out the similar question which is answered already.

CSS Background Gradient with offset

header{
height:100px;
border:1px solid blue;
background: linear-gradient(to top, #e20e0e 50px, #0000 50px);
background-position: 50px;
background-repeat: no-repeat;
}
<header></header>
Prajwal
  • 3,930
  • 5
  • 24
  • 50