html - Not able to set background color for navigation menu -


i working on underscores.me(by automattic wordpress team) starter theme create new wordpress theme(my first theme).

i setting styles theme stuck @ point want set background color navigation menu

/* =menu ----------------------------------------------- */  .navigation-main {     clear: both;     display: block; } .navigation-main ul {     list-style: none;     margin: 0;     padding-left: 0; } .navigation-main li {     float: left;     margin: 0.5em 0;     position: relative;     background-color: #ffffff; } .navigation-main {     display: block;     color: #5fbfe7;     margin-right: 20px;     text-decoration: none; } .navigation-main ul ul {     box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);     display: none;     float: left;     position: absolute;         top: 1.5em;         left: 0;     z-index: 99999; } .navigation-main ul ul ul {     left: 100%;     top: 0; } .navigation-main ul ul {     width: 200px; } .navigation-main ul ul li { } .navigation-main li:hover > { } .navigation-main ul ul :hover > { } .navigation-main ul ul a:hover { } .navigation-main ul li:hover > ul {     display: block; } .navigation-main li.current_page_item a, .navigation-main li.current-menu-item { }  /* small menu */ .menu-toggle {     display: none;     cursor: pointer; }  .main-small-navigation ul {     display: none; }  @media screen , (max-width: 600px) {     .menu-toggle,     .main-small-navigation ul.nav-menu.toggled-on {         display: block;     }      .navigation-main ul {         display: none;     } } 

and header.php file of theme working on:

<!doctype html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width" /> <title><?php wp_title( '|', true, 'right' ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <!--[if lt ie 9]> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script> <![endif]-->  <?php wp_head(); ?> </head>  <body <?php body_class(); ?>> <div id="page" class="hfeed site">     <?php do_action( 'before' ); ?>     <header id="masthead" class="site-header" role="banner">         <hgroup>             <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>             <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>         </hgroup>          <nav id="site-navigation" class="navigation-main" role="navigation">             <h1 class="menu-toggle"><?php _e( 'menu', 'lemon' ); ?></h1>             <div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( 'skip content', 'lemon' ); ?>"><?php _e( 'skip content', 'lemon' ); ?></a></div>              <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>         </nav><!-- #site-navigation -->     </header><!-- #masthead -->      <div id="main" class="site-main"> 

there no problem when set background color of list or tag nothing happens when set background color ul tag or .navigation-main.

try adding float: left; .navigation-main.

so change this:

.navigation-main {     clear: both;     display: block; } .navigation-main ul {     list-style: none;     margin: 0;     padding-left: 0; } .navigation-main li {     float: left;     margin: 0.5em 0;     position: relative;     background-color: #ffffff; } 

to this:

.navigation-main {     clear: both;     display: block;     background-color: #000000;         float: left; } .navigation-main ul {     list-style: none;     margin: 0;     padding-left: 0; } .navigation-main li {     float: left;     margin: 0.5em 0;     position: relative;     background-color: #ffffff; } 

this works me. here url jsfiddle see working: http://jsfiddle.net/s9lup/


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -