How to position: fixed in css to locate relative to the parent

In project development, we often use the position: fixed attribute, which is often applied when the navigation bar is fixed to the top when the scroll bar is pulled down, and the advertisement is fixed on both sides of the page or in the middle of the browser. When we use position: fixed to locate the attribute, it generates
web front end 2023.02.12 zero three thousand eight hundred and twenty