# Fix navbar-fixed-top with wordpress adminbar

**URL:** https://discourse.roots.io/t/fix-navbar-fixed-top-with-wordpress-adminbar/1233
**Category:** archived 🗄
**Created:** 2014-02-14T18:34:43Z
**Posts:** 4

## Post 1 by @chrillep — 2014-02-14T18:34:43Z

First off add

```
body {
 padding-top: @navbar-height + 1px; // +1 or how thick your .navbar-fixed-top border is.
}
```

to \> theme/assest/less/app.less

then add

```
<?php if ( is_admin_bar_showing() ) {?>
 <style>
  .navbar-fixed-top { top: 46px !important; } /*wordpress adminbar height small screen */
   @media (min-width: 768px) {
    .navbar-fixed-top { top: 32px !important; } /*wordpress adminbar height big screen */
   }
 </style>
<?php
}?>
```

to \> theme/templates/head.php

[learned from dotnordic.se](http://dotnordic.se/twitter-bootstrap-navbar-fixed-top-conflict-with-wordpress-admin_bar/)

---

## Post 2 by @gfaw20071 — 2014-04-29T11:00:05Z

Thanks for this, bothered me long time!

---

## Post 3 by @kdb — 2014-05-01T17:21:21Z

Using the following in your app.less works without inline styles:

```
body.admin-bar {
    .navbar-fixed-top {
        // reserve space for the admin bar
        top: 32px !important;
    }
}
```

Add changes for other media queries as you like.

---

## Post 4 by @gfaw20071 — 2014-05-03T19:23:39Z

Even better! Thanks!

---

## Post 5 by @ben — 2022-02-26T03:06:13Z


