Search code examples
csspaddingmarginfooter

How to move the text in a footer over slightly


I have a footer and I want all the text in it to move over to the left slightly so it looks a little more centered. If I add a margin or change the padding them will alter all the 's and I don't want to do that. I just want to move the text (links) as a whole over a little.

.footer {
  background: #3E3D3D;
  padding: 0.625rem 0.75rem;
}

.footer_list {
  /*ul*/
  list-style: none;
  text-align: center;
  margin: 0;
}

.footer_lists {
  display: inline-block;
  padding: 0px 1rem;
}

.footer_lists a {
  color: white;
  text-decoration: none;
  font-family: 'Oswald', sans-serif;
}

.footer_lists a:hover,
.footer_lists a:active {
  color: silver;
}
<footer class="footer">
  <ul class="footer_list">
    <li class="footer_lists"><a href="about.html">About Us</a></li>
    <li class="footer_lists"><a href="Contact.html">Contact</a></li>
    <li class="footer_lists"><a href="privacy.html">Privacy Policy</a></li>
  </ul>
</footer>


Solution

  • On <ul> tag, by default, padding-inline-start CSS attribute value is set as 40px. So you need to reset this value.

    .footer {
      background: #3E3D3D;
      padding: 0.625rem 0.75rem;
    }
    
    .footer_list {
      /*ul*/
      list-style: none;
      text-align: center;
      margin: 0;
      padding-inline-start: 0;
    }
    
    .footer_lists {
      display: inline-block;
      padding: 0px 1rem;
    }
    
    .footer_lists a {
      color: white;
      text-decoration: none;
      font-family: 'Oswald', sans-serif;
    }
    
    .footer_lists a:hover,
    .footer_lists a:active {
      color: silver;
    }
    <footer class="footer">
      <ul class="footer_list">
        <li class="footer_lists"><a href="about.html">About Us</a></li>
        <li class="footer_lists"><a href="Contact.html">Contact</a></li>
        <li class="footer_lists"><a href="privacy.html">Privacy Policy</a></li>
      </ul>
    </footer>