0

I have tried this for two days but still I couldn't find the solution can any one please help me in this.

Jeeva
  • 1

2 Answers2

0

I suppose your header HTML be like:

the CSS for it to stick on top must be:

.header {
  position: fixed;
  width: 100vw;
  top: 0px;
  left: 0px;
}
Cuong Hoang
  • 558
  • 1
  • 3
  • 14
  • i tried this already but when we give position as fixed it is at the top of the page, but i need like after scrolling down to the header position it should be fixed at the top. – Jeeva Sep 14 '20 at 08:22
0

you can use sticky

    .header {position: sticky;}
Gina Habib
  • 21
  • 1
  • 5