Home  >  Article  >  Web Front-end  >  How to Fix the Sidebar Navigation in Fluid Twitter Bootstrap 2.0?

How to Fix the Sidebar Navigation in Fluid Twitter Bootstrap 2.0?

Susan Sarandon
Susan SarandonOriginal
2024-11-11 16:01:02364browse

How to Fix the Sidebar Navigation in Fluid Twitter Bootstrap 2.0?

Fix the Sidebar Navigation in Fluid Twitter Bootstrap 2.0

Achieving a sidebar navigation that remains stationary while scrolling in a fluid layout is straightforward.

Implementation

CSS

Define a new sidebar-nav-fixed class to fix your sidebar and add an offset class to your content div to compensate for the left margin:

Updated Option

For responsive compatibility, consider the following CSS:

HTML

Note that there is a minor width discrepancy in the fixed sidebar due to it not inheriting the width from the container div.

Alternative Method

To keep the sidebar fixed until the grid drops for mobile view, use this CSS:

The above is the detailed content of How to Fix the Sidebar Navigation in Fluid Twitter Bootstrap 2.0?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn