Home >Web Front-end >CSS Tutorial >How to Fix Navbar Blocking Website Content in Twitter Bootstrap?
Navbar Blocking Website Content
This issue arises when using Twitter Bootstrap's top-fixed navbar. Initially, users may observe content being obstructed by the navbar when viewing the page's top. To rectify this issue and prevent content from being blocked, the following solution can be implemented:
As suggested in the response, simply adding padding to push the content down is insufficient for responsive Bootstrap frameworks. When resizing the browser window, a gap could appear between the page's top and the navbar.
Therefore, a more comprehensive approach is recommended:
body { padding-top: 60px; } @media (max-width: 979px) { body { padding-top: 0px; } }
This CSS code adds a 60px top padding to the body, effectively pushing the main content below the navbar. However, for mobile or smaller screen sizes (screen widths less than 979px), the top padding is removed to avoid overlapping issues.
By implementing this solution, users can ensure that the navbar remains fixed at the top of the page but no longer disrupts the viewing experience of nearby content.
The above is the detailed content of How to Fix Navbar Blocking Website Content in Twitter Bootstrap?. For more information, please follow other related articles on the PHP Chinese website!