针对内部页面元素的css

I have a Wordpress site and I want to change the css on an element if the user is on the index.php page or single.php

The element css

#nav-icon span {
   background-color: #fff;
}

on the index page I want it to remain #fff, but on single.php I want it to be #000.

EDIT - One issue is that the #nav-icon div is in the header.php (so it is on every page)

Here you go with a solution using jQuery

If you are in index page

$(document).find('#nav-icon span').css({
  'background-color': '#fff'
});

In single.php

$(document).find('#nav-icon span').css({
  'background-color': '#000'
});

Hope this will help you.