0

I'm not sure if this may be due to php/wordpress but I've got a nav bar that I just realised when you click the link it stays underlined until you hover it again? Seems strange to me I've never had this happen and can't quite work out why..

<nav>
   <ul>
      <li><a href="#"><img src=" " height="10%" width="10%"/>Link 1</a></li>

      <li><a href="#"><img src=" " height="10%" width="10%"/><a href="#">Link 2</a></li>

      <li><a href="#"><img src="" height="10%" width="10%"/><a href="#">Link 3</a></li>
   </ul>
</nav>

scss..

nav {
  margin: 0px;
  background-color: $nav_bgcolor;
  box-shadow: $nav_shadow;

   ul {
    color: #979797;
    padding: 0px;
    display: table;
    width: 100%;
    padding: 15px;
    margin: 0px;
    text-align: center;
  }
   ul li {
    list-style-type: none;
    display: inline-block;
    width: 30%;
  }
   ul li a {
    color: $font_color;
  }
   ul li a:hover {
    cursor: pointer;
    color: $hover;
  }
   a, a:visited, a:active, a:visited, a:focus, a:hover {
    text-decoration: none !important;
 }
}
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
snw123
  • 21
  • 4

3 Answers3

0

change your " ul li a" , to this:

nav ul li a {
color: $font_color;
text-decoration: none;
}
Chandra Shekhar
  • 3,550
  • 2
  • 14
  • 22
Yinkci Heart
  • 160
  • 1
  • 14
0

My code above was actually correct in fixing the problem I had. The problem was happening as it wasn't updating any of my code as the browser had cached the site. Thanks everyone for your help

NOTE: Delete browser history!!

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
snw123
  • 21
  • 4
0

You Need some HTML Fixes. You have used anchor tag inside anchor tag.

HTML

<nav>
   <ul>
      <li>
        <a href="#">
          <img src="" height="10%" width="10%"/>Link 1
        </a>
      </li>

      <li>
        <a href="#">
          <img src="" height="10%" width="10%"/>Link 2
        </a>
       </li>

      <li>
        <a href="#">
          <img src="" height="10%" width="10%"/>Link 3
        </a>
      </li>
   </ul>
</nav>

CSS

/*Random colors use your colors here*/
$nav_bgcolor:red;
$nav_shadow:black;
$font-color:white;
$hover:green;

/*Random colors use your colors here*/

nav {
  margin: 0px;
  background-color: $nav_bgcolor;
  box-shadow: $nav_shadow;

   ul {
    color: #979797;
    padding: 0px;
    display: table;
    width: 100%;
    padding: 15px;
    margin: 0px;
    text-align: center;
  }
   ul li {
    list-style-type: none;
    display: inline-block;
    width: 30%;
  }
   ul li a {
    color: $font_color;
    text-decoration:none;
  }
   ul li a:hover {
    cursor: pointer;
    color: $hover;
  }
   a, a:visited, a:active, a:visited, a:focus, a:hover {
    text-decoration: none !important;
 }
}
Chandra Shekhar
  • 3,550
  • 2
  • 14
  • 22