Efrain Sanjay Adhikary
Efrain Sanjay Adhikary

Reputation: 326

Adjust position: Fixed in Two different component of React

Greetings all the way !

As in picture enter image description here In Home Component i wrap the Container as:

"z-index": 1,
position: "fixed",
left: 0,
right: 0,
top: 0

and in App Component

<Header />
<Home />

then certain height of Home was overlapped with Header ! and yet i don't know the height of header ! its responsive to the width of screen ! I want to adjust the Home Component as height of Header.

extra question: How can i achieve header like this when scroll page in react .

Upvotes: 0

Views: 720

Answers (1)

Ihor
Ihor

Reputation: 324

I'd suggest you do not rely on undetermined height of Header. Use some height (about 50px) and then you can set margin-top: 50px for the Home component.

Otherwise, you can use some third-party library:

I think they have what you need.

Upvotes: 1

Related Questions