×
Menu
Index

An alternative styling possibility for scrolling elements to the top and pin them (Advanced)

 
This tutorial shows an alternative styling possibility for the tutorial "Scroll elements to the top and pin them there".
 
We will leave the background of the navigation bar as transparent and add an empty text element behind the navigation bar. The background of the text element will become white only when it is pinned to the top together with the navigation bar as shown below.
 
For illustration, we also set the background color of the page to "#ECF7FB". For how to change the background color of a page, you can check out the steps about adding background color in this tutorial "Add background color and image to a page".
 
If the navigation bar is at the top of the page rather than below the logo, this approach still works. The background of the text element will become white when the page starts to scroll and the text element is pinned to the top.