Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Fixed navigation bar problem

Featured Replies

That is the expected behaviour of position:fixed. It is now "above" other content (stuff will scroll beneath it). You need to add a margin to the first element on the page of at least the height of the navigation bar to offset the rest of the content appropriately.

not sure what your trying to do could add top:0 to your nav and then top padding matching the nav height to the body

 

 

Andy beat me to it

Edited by mteam

  • Author

That is the expected behaviour of position:fixed. It is now "above" other content (stuff will scroll beneath it). You need to add a margin to the first element on the page of at least the height of the navigation bar to offset the rest of the content appropriately.

 

Wanted the nav to be fixed, so when viewed on a smartphone it will always be there, and when it is fixed is where the problem starts. Have tried to add extra margin but doesn't seem to do anything.

Try adding to body

 

padding:44px 0 0;

 

to nav

top:0;

 

the padding is just filling the space where the nav would be as using position fixed takes it out of the flow

  • Author

Try adding to body

 

padding:44px 0 0;

 

to nav

top:0;

 

the padding is just filling the space where the nav would be as using position fixed takes it out of the flow

 

I think thats sorted that out. The words are now slightly off centre.

ul {
text-align: center;
width: auto;
}

You've removed margin:0 from the body your padding will probably want adjusting round about 52px by the look of things

Edited by mteam

Wanted the nav to be fixed, so when viewed on a smartphone it will always be there, and when it is fixed is where the problem starts. Have tried to add extra margin but doesn't seem to do anything.

 

Yes it will do, you may need to add a wrapper to the content though.

 

You should be using a CSS reset which would eradicate the new offset text problem.

Edited by andyl

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.