Header is not getting fixed position while scrolling

Here I have provided the link of Js fiddle https://jsfiddle.net/orfgrs23/8/

While scrolling the page, the header is also getting scrolling down. But I need header needs to be in fixed position. Please provide me suggestion on this.

Thanks in advance
Boopathy SAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ayoub RouziCeo & CoFounderCommented:
Hello,

To create a fixed top header, use
position:fixed 

Open in new window

and
top:0 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Boopathy SAuthor Commented:
Hi Ayoub Rouzi. Thanks. I have edited in jsfiddle. Please see the link.

I have used the position

.content-header-row{
  position: fixed;
}

Open in new window


When I use the top: 0; in that. The first row is getting erased. Please see the link on question
0
Ayoub RouziCeo & CoFounderCommented:
Yes that is normal, you have to add an empty line or make a <br>
0
Boopathy SAuthor Commented:
Hi, Thanks. I need to add empty line in css? If I add the empty line code as like below

.content-header-row{
  position: fixed;
    margin-top: -2em;
  display: block;
 
}

https://jsfiddle.net/orfgrs23/29/

It affecting the above line. Is that I used in correct way? Or I need to change something? Please advice
0
Ayoub RouziCeo & CoFounderCommented:
I think that the author used my solution, the last question is another one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.