繁体   English   中英

如何在保持文本居中的同时降低页脚的高度

[英]how to decrease the height of the footer while keeping the text inside centered

这是我的 css 代码我尝试使用填充、边距和其他一些东西来减小尺寸高度,但它没有用,但它们都会将页脚完全移出底部或使文本不居中。

footer {
  background: #fce138;
  width: 100%;
  padding: -100px 0;
}

footer h2 {
  display: inline;
  color: #024e76;
  font-size: 30px;
  margin: 0;
}

footer div {
  float: right;
  line-height: 1.5;
  text-align: right;
}

footer a {
  color: #024e76;
}

这是我的 HTML 代码

<footer>
    <section>
    <h2> ❤️ Made with love by Run Buddy</h2>
    <div>
      <a href="#">Read Our Privacy Policy</a><br/>
      &copy; 2019 Run Buddy, Inc.
    </div>
  </section>
</footer>

页脚图片

HTML:

<footer>
<h2> ❤️ Made with love by Run Buddy</h2>
<div>
  <a href="#">Read Our Privacy Policy</a><br/>
  &copy; 2019 Run Buddy, Inc.
</div>

CSS:

footer {
  background: #fce138;
  width: 100%;
  height:200px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

footer h2 {
  display: inline;
  color: #024e76;
  font-size: 30px;
  margin: 0;
}

footer div {
  float: right;
  line-height: 1.5;
  margin-right:10px;
  text-align: right;
}

footer a {
  color: #024e76;
}

您可以为页脚中的高度值提供您想要的任何值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM