gpt4 book ai didi

html - 将页脚内容居中

转载 作者:行者123 更新时间:2023-11-28 08:06:39 25 4
gpt4 key购买 nike

我正在使用 wordpress 主题构建一个网站,它应该是响应式的。问题出在页脚上。当您调整浏览器窗口的大小并使其变小时,页脚的内容不会居中。我认为这是因为每个文本的 float 。如何在调整窗口大小时使它居中?

WEBSITE

 <div class="site-info">
<div style="margin:0 auto; width: 75%;">
<p style="float:left;">&copy; Copyright <?= date('Y'); ?> Hotel Švýcarský Dům</p>
<div style="float:right;">Naleznete nás na sociálních sítích:
<a style="display: block; float:right; margin:-4px 0 0 5px;" href=""><img src="/wp-content/themes/adamos/images/gplus.png" /></a>
<a style="display: block; float:right; margin:-4px 5px 0 5px;" href=""><img src="/wp-content/themes/adamos/images/facebook.png" /></a>
</div>
<div class="clear"></div>
</div>
</div><!-- .site-info -->

最佳答案

将文本的父 div 设置为 100% 宽度使文本居中对齐。

<div class="site-info">
<div style="margin:0 auto; width: 75%;">
<p style="float:left; width:100%">&copy; Copyright <?= date('Y'); ?> Hotel Švýcarský Dům</p>
<div style="float:right; width:100%">Naleznete nás na sociálních sítích:
<a style="display: block; float:right; margin:-4px 0 0 5px;" href=""><img src="/wp-content/themes/adamos/images/gplus.png" /></a>
<a style="display: block; float:right; margin:-4px 5px 0 5px;" href=""><img src="/wp-content/themes/adamos/images/facebook.png" /></a>
</div>
<div class="clear"></div>
</div>
</div><!-- .site-info -->

由于该 div 中的图像链接,第二个 div 稍微偏离中心。

关于html - 将页脚内容居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29458559/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com