How do I change the color of theses links in CSS from the default blue?

I have put the style text-decoration: none; color: black; but it does not seem to be applying. I look on the inspection tab and it’s showing that it’s applied but the text does not change.

.Bottom-Grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(1, 1fr);
  grid-column-gap: 0px;
  grid-row-gap: 0px;
  height: 150px;
  width: auto;
  text-transform: capitalize;
  font-size: 15px;
  font-family: GT Pressura Mono, Roboto Mono, monospace;
}

.List-Five,
.List-Six,
.List-Seven,
.List-Eight,
.link-1 {
  list-style-type: none;
  text-decoration: none;
  color: black;
}
<div class="Bottom-Grid">
  <div class="five">
    <ul class="List-Five">
      <li class="link-1"><a href="#">all</a></li>
      <li class="link-2"><a href="#">Tea</a></li>
      <li class="link-3"><a href="#">Merch</a></li>
      <li class="link-4"><a href="#">Brew Wares</a></li>
    </ul>
  </div>
  <div class="six">
    <ul class="List-Six">
      <li class="link-5"><a href="#">Wholesale</a></li>
      <li class="link-6"><a href="#">About Us</a></li>
      <li class="link-7"><a href="#">Contact</a></li>
      <li><a href="#">FAQs</a></li>
    </ul>
  </div>
  <div class="seven">
    <ul class="List-Seven">
      <li class="link-8"><a href="#">my orders</a></li>
      <li class="link-9"><a href="#">sign up</a></li>
    </ul>
  </div>
  <div class="eight">
    <ul class="List-Eight">
      <li class="link-9"><a href="#">terms & conditions</a></li>
      <li class="link-10"><a href="#">privacy Policy</a></li>
    </ul>
  </div>
</div>

As you can see, the style is applied but the links are still that default blue.

>Solution :

You are applying the styles to li not a

There is 2 solutions for you:

Solution 1 – add a to the selector of each rule

.Bottom-Grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(1, 1fr);
  grid-column-gap: 0px;
  grid-row-gap: 0px;
  height: 150px;
  width: auto;
  text-transform: capitalize;
  font-size: 15px;
  font-family: GT Pressura Mono, Roboto Mono, monospace;
}

.List-Five a,
.List-Six a,
.List-Seven a,
.List-Eight a,
.link-1 a {
  list-style-type: none;
  text-decoration: none;
  color: black;
}
<div class="Bottom-Grid">
  <div class="five">
    <ul class="List-Five">
      <li class="link-1"><a href="#">all</a></li>
      <li class="link-2"><a href="#">Tea</a></li>
      <li class="link-3"><a href="#">Merch</a></li>
      <li class="link-4"><a href="#">Brew Wares</a></li>
    </ul>
  </div>
  <div class="six">
    <ul class="List-Six">
      <li class="link-5"><a href="#">Wholesale</a></li>
      <li class="link-6"><a href="#">About Us</a></li>
      <li class="link-7"><a href="#">Contact</a></li>
      <li><a href="#">FAQs</a></li>
    </ul>
  </div>
  <div class="seven">
    <ul class="List-Seven">
      <li class="link-8"><a href="#">my orders</a></li>
      <li class="link-9"><a href="#">sign up</a></li>
    </ul>
  </div>
  <div class="eight">
    <ul class="List-Eight">
      <li class="link-9"><a href="#">terms & conditions</a></li>
      <li class="link-10"><a href="#">privacy Policy</a></li>
    </ul>
  </div>
</div>

Solution 2 – inherit properties

.Bottom-Grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(1, 1fr);
  grid-column-gap: 0px;
  grid-row-gap: 0px;
  height: 150px;
  width: auto;
  text-transform: capitalize;
  font-size: 15px;
  font-family: GT Pressura Mono, Roboto Mono, monospace;
}

.List-Five,
.List-Six,
.List-Seven,
.List-Eight,
.link-1 {
  list-style-type: none;
  text-decoration: none;
  color: black;
}

.Bottom-Grid a {
  color: inherit;
  text-decoration: inherit
}
<div class="Bottom-Grid">
  <div class="five">
    <ul class="List-Five">
      <li class="link-1"><a href="#">all</a></li>
      <li class="link-2"><a href="#">Tea</a></li>
      <li class="link-3"><a href="#">Merch</a></li>
      <li class="link-4"><a href="#">Brew Wares</a></li>
    </ul>
  </div>
  <div class="six">
    <ul class="List-Six">
      <li class="link-5"><a href="#">Wholesale</a></li>
      <li class="link-6"><a href="#">About Us</a></li>
      <li class="link-7"><a href="#">Contact</a></li>
      <li><a href="#">FAQs</a></li>
    </ul>
  </div>
  <div class="seven">
    <ul class="List-Seven">
      <li class="link-8"><a href="#">my orders</a></li>
      <li class="link-9"><a href="#">sign up</a></li>
    </ul>
  </div>
  <div class="eight">
    <ul class="List-Eight">
      <li class="link-9"><a href="#">terms & conditions</a></li>
      <li class="link-10"><a href="#">privacy Policy</a></li>
    </ul>
  </div>
</div>

Leave a Reply