【问题标题】:How to set margin-top proeprly in WordPress? [duplicate]如何在 WordPress 中正确设置 margin-top? [复制]
【发布时间】:2017-11-21 17:45:48
【问题描述】:

我正在制作我的 WP 自定义主题的页脚。我有页脚 div(我在其中放置组件)。我还有一个徽标 div(我的徽标在哪里)。我需要从页脚 div 的开始到徽标 div 之间 12px 的距离。

我正在使用这个:

<div class="footer">
  <div class="footerlogo"> 
  <img id="pic" src="<?php bloginfo('template_url') ?>/img/footer_logo.png">
    </div> .......


.footerlogo{ margin-top:30px;}

它没有显示任何差异。这样做的正确方法是什么?

enter image description here

【问题讨论】:

    标签: html css wordpress wordpress-theming


    【解决方案1】:

    您可以在页脚 div 上使用填充,例如:

    .footer {
        padding-top: 12px;
    }
    

    这会在.footer.footerlogo div 元素之间添加空格。

    https://jsfiddle.net/ss7Lp2nd/

    【讨论】:

    • 使用填充仍然没有改变。
    • 我在原始答案中添加了一个小提琴以更好地证明这一点。
    • 完美!谢谢!
    猜你喜欢
    • 2016-01-06
    • 2020-01-24
    • 1970-01-01
    • 2011-09-19
    • 1970-01-01
    • 1970-01-01
    • 2017-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多