What is the best way to make a fixed topbar that does not straddle the top?
source link: https://www.codesd.com/item/what-is-the-best-way-to-make-a-fixed-topbar-that-does-not-straddle-the-top.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
What is the best way to make a fixed topbar that does not straddle the top?
For instance stackoverflow has a topbar for new members. The topbar is fixed and pushes down the page without overlapping the top of the page.
How is this accomplished?
Javascript? Or can this be done with just css?
You could do something like this to create a fixed header:
<style>
body { margin: 0; }
div.header { position: fixed; height: 50px; width: 100%; }
div.content { padding-top: 50px; }
</style>
<body>
<div class="header">header</div>
<div class="content">content</div>
</body>
Maybe check out the ie5.5 / ie6.0 fix here: http://www.howtocreate.co.uk/fixedPosition.html
Related Articles
What is the best way to check if an Eloquent query does not return an answer?
What is the correct way to cancel an asynchronous operation that does not accept a CancellationToken?
Is there a way to open a new connection that does not participate in the current TransactionScope?
How can I make fun of something that "does not implement"? a particular method?
One way to have a model attribute that does not persist in the database as a table column
Is there a way to plan a cron job that does not work on the 3rd weekend of the month?
A way to generate a unique number that does not repeat within a reasonable time?
way to find a first index that does not match in 2 strings
Python + requests + splinter: what is the fastest / best way to make multiple "get" requests simultaneously?
What is the best way to make the largest advertising space available in its container when using a reactive design?
The best way to make popups / dialogs with JQuery?
The best way to make a viewcontroller for different screens
What is the best way to develop a mobile app that runs on multiple devices mainly (Android and iPhone)?
The best way to make login_required the default login for Flask-Login
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK