January 3, 201313 yr Hello The navigation bar I have fixed at the top of the screen but it is now covering half an image when viewed on a smartphone and Chrome. I can't fathom why it is doing that. Any thoughts? Thank you http://www.smortimer...o.uk/test1.html
January 3, 201313 yr 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.
January 3, 201313 yr 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 January 3, 201313 yr by mteam
January 3, 201313 yr 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.
January 3, 201313 yr 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
January 3, 201313 yr 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; }
January 3, 201313 yr You've removed margin:0 from the body your padding will probably want adjusting round about 52px by the look of things Edited January 3, 201313 yr by mteam
January 3, 201313 yr 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 January 3, 201313 yr by andyl
Create an account or sign in to comment