Way to make sticky navigation bar work inside other components?
P粉579008412
2023-08-15 10:42:23
<p>I have the following structure in my project: </p>
<pre class="brush:php;toolbar:false;"><app-nav-bar></app-nav-bar>
<app-slider></app-slider>
<app-solution></app-solution>
<app-platform></app-platform>
<app-team></app-team>
<app-contact></app-contact>
<app-footer></app-footer></pre>
<p>The sticky navigation bar is not working as it only works within its component, how to make it work within the component and keep it on top. </p>
<p>I tried putting it in app.component.html but it doesn't work. </p>
HTML arranges application components in a container, including app-nav-bar on top, followed by other components. Padding provides space for a sticky navigation bar. CSS styles app-nav-bar to make it sticky on top, with background color, white text and padding. It stays fixed while scrolling due to position: sticky;.