Title: adding code for fixed bar for scrolling
Last modified: August 31, 2016

---

# adding code for fixed bar for scrolling

 *  [nonamer](https://wordpress.org/support/users/localgreeneats/)
 * (@localgreeneats)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/)
 * I am using this
    .secondary-menu { height: 20px; width: 90%; position: fixed;
   top: 0; }
 * to have a fixed bar for scrolling but on some pages it doesn’t look very nice
   with a black background. Any ideas on how to fix this?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Jake](https://wordpress.org/support/users/jakewpsupport/)
 * (@jakewpsupport)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449374)
 * Hi [@localgreeneats](https://wordpress.org/support/users/localgreeneats/),
 * The website is at [http://www.localgreeneats.com/](http://www.localgreeneats.com/),
   correct?
 * After inspecting your site, I was confused because I did not see any “black background”.
   I did notice however that when scrolling, your content `<header>` is fixed position
   with a white background, and this looks kinda strange. Currently, the secondary
   menu is not set to fixed position, but if you change this, you may want to change
   the background color if it looks strange with a black background.
 *     ```
       .secondary-menu {
       background: ??????;
       }
       ```
   
 * Another thing I noticed that seems strange to me is that your main navigation
   menu is using the .secondary-menu class. Is there not a primary menu option with
   your theme? Though not necessary, convention usually has this menu as the primary,
   and maybe use the secondary as an auxiliary menu.
 *  Thread Starter [nonamer](https://wordpress.org/support/users/localgreeneats/)
 * (@localgreeneats)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449381)
 * Thanks for the feedback Jake.
 * I was using
    .secondary-menu { height: 20px; width: 90%; position: fixed; top:
   0; }
 * to have a fixed menu but since it didn’t look very appealing, I got rid of it.
 * Ideally what I want to do is create a fixed menu for my menu bar (home, contact
   us, services…. buttons).
 * But in addition to that fixed menu, I also want to have a fixed banner/header
   for the blog page only, hence the current code
 * header {
    position: fixed; width: 1150px; padding: 15px, 0; margin: 0; text-align:
   center; font-size: 10px; line-height: -10px; height: 208px; top: 0; background:
   white; color: #fff; font-family: ‘PT Sans’, sans-serif; }
 * Ideally I want to only display this fixed banner/header on the blog page ( with
   additions of image & text).
 *  Thread Starter [nonamer](https://wordpress.org/support/users/localgreeneats/)
 * (@localgreeneats)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449382)
 * Your points are very valid, however I don’t know how to set the secondary menu
   as primary menu so that’s the problem.
 * “Currently, the secondary menu is not set to fixed position, but if you change
   this, you may want to change the background color if it looks strange with a 
   black background.”
    How do I change the background color as well as move secondary
   menu to primary to reflect the changes?
 * Thanks for your help
 *  Thread Starter [nonamer](https://wordpress.org/support/users/localgreeneats/)
 * (@localgreeneats)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449383)
 * This is also why I’ve inquired for removing sticky header from all pages, but
   one: [https://wordpress.org/support/topic/removing-sticky-header-from-certain-pages?replies=4](https://wordpress.org/support/topic/removing-sticky-header-from-certain-pages?replies=4)
 *  [Jake](https://wordpress.org/support/users/jakewpsupport/)
 * (@jakewpsupport)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449388)
 * Depending of course on what theme you’re using, you may be able to utilize the
   WordPress custom header feature. Log into the Dashboard/admin area and go to 
   Appearance/Header, then select an image for the [custom header](https://codex.wordpress.org/Appearance_Header_Screen)(
   if supported). You could then specify with css to display or not display the 
   header on specified pages.
 *  [Jake](https://wordpress.org/support/users/jakewpsupport/)
 * (@jakewpsupport)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449389)
 * In your admin area, you may want to go to Appearance/Menu to see if you can setup
   a primary menu…it just seems odd if the theme has a secondary menu but not primary.
 *  [Jake](https://wordpress.org/support/users/jakewpsupport/)
 * (@jakewpsupport)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449390)
 * To remove styles from all pages but one, you well probably want to set a display:
   none “globally” or to all the pages, and then a display: block to the one page
   you want it to show. Also, just wanted to make sure you’re using a [child theme](https://codex.wordpress.org/Child_Themes)
   to make these changes, so when you upgrade your theme they won’t be lost.
 *  Thread Starter [nonamer](https://wordpress.org/support/users/localgreeneats/)
 * (@localgreeneats)
 * [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449396)
 * Unfortunately moving the menu to primary section, it no longer is viewable. I
   may have to move it back down to “below header” as its original location.
 * I am making these changes in the child theme (or what I know as the css in the
   editor).

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘adding code for fixed bar for scrolling’ is closed to new replies.

## Tags

 * [fixed](https://wordpress.org/support/topic-tag/fixed/)
 * [scroll](https://wordpress.org/support/topic-tag/scroll/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [nonamer](https://wordpress.org/support/users/localgreeneats/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/adding-code-for-fixed-bar-for-scrolling/#post-7449396)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
