【问题标题】:How to move the text in a footer over slightly如何将页脚中的文本稍微移动
【发布时间】:2021-01-29 03:32:26
【问题描述】:

我有一个页脚,我希望其中的所有文本稍微向左移动,这样它看起来更居中。如果我添加边距或更改填充,它们将更改所有 's,我不想这样做。我只是想将整个文本(链接)移动一点。

.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>

【问题讨论】:

    标签: css padding margin footer


    【解决方案1】:

    &lt;ul&gt; 标签上,默认情况下padding-inline-start CSS 属性值设置为40px。所以你需要重新设置这个值。

    .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>

    【讨论】:

    猜你喜欢
    • 2020-12-09
    • 1970-01-01
    • 1970-01-01
    • 2016-06-24
    • 1970-01-01
    • 2014-12-31
    • 1970-01-01
    • 2016-05-27
    • 2020-07-13
    相关资源
    最近更新 更多