Home > database >  why when I am giving a:link color: red; it is not changing it's color?
why when I am giving a:link color: red; it is not changing it's color?

Time:11-09

Sorry my English is not good) So I was repeating after tutorial and the tutor wrote a:link and gave a property color:red; but when i did so it didn't change it's color here is html:

<nav >
  <ul >
    <li><a href="" >About us</a></li>
    <li><a href="" >Pricing</a></li>
    <li><a href="" >Contact</a></li>
  </ul>
  <div >
    <a href="" >Sign up</a>
    <a href="" >Get a quote</a>
  </div>
</nav>

and SCSS:

.navigation{
  list-style-type: none;
  float: left;
  
  li{
    display: inline-block;
    margin-left: 30px;
    
    &:first-child{
      margin: 0;
    }
    a:link{
      color: red;
    }
  }
  
}

I wanted a to change it's color

CodePudding user response:

Put a value in the href. Like:

<nav >
  <ul >
    <li><a href="..." >About us</a></li>
    <li><a href="..." >Pricing</a></li>
    <li><a href="..." >Contact</a></li>
  </ul>
  <div >
    <a href="..." >Sign up</a>
    <a href="..." >Get a quote</a>
  </div>
</nav>

CodePudding user response:

As Rahul Kumar commented, try changing "a:link" to just "a" or "a:active"

a:active{
      color: red;
}

CodePudding user response:

To fix the problem put in the href a # this will navigate to no where but will most likely fix your problem.

  • Related