简体   繁体   English

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

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

This is my css code I tried using padding, margin and a few other things to decrease the size height but it did not work but all of them would either move the footer out of the bottom completely or leave the text uncentered.这是我的 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;
}

This is my HTML code这是我的 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>

footer image页脚图片

HTML: 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: 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;
}

You can give whatever value you want to the height value in the footer.您可以为页脚中的高度值提供您想要的任何值。

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

相关问题 CSS 使图像以移动视图为中心,同时保持高度相同? - CSS make Image centered on mobile view while keeping height the same? 如何在将文本框居中的同时将错误消息移至文本框的右侧? - how do I move the error messages to the right of the text boxes while keeping the text box centered? 如何在保持文本垂直居中的同时使div的大小与另一个div相同? - How can I make a div grow the same size as another div, while keeping it's text vertically centered? 强制div的高度填充浏览器,同时保持页脚固定 - Force height of div to fill browser while keeping sticky footer in place 如何减少引导程序中输入文本字段的高度? - How to decrease the height of the input text field in bootstrap? 在容器内保持几个Divs居中。 脚注也卡在中间 - Keeping several Divs centered inside a container. Also Footer stuck in middle 页脚左侧为文本,文本为中心 - Footer with text on the left and text centered 如何在保持居中状态的同时防止div破裂 - How to keep divs from breaking while keeping them centered 如何在内容保持居中状态之前缩小间距 - How to make the spacing shrink before content while keeping the content centered 如何在保持项目居中的同时更改弹性列宽 - How to change flex column width while keeping item centered
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM