【问题标题】:How to center footer links in magento?如何在magento中居中页脚链接?
【发布时间】:2015-09-01 15:57:52
【问题描述】:

尊敬的 Stackoverflow 社区,

我只是不知道如何在我的 magento 网站上将页脚链接居中。页脚链接在一个 div 中,而我认为对应的 CSS 如下:

我已经尝试了所有方法,从 margin:auto 到 margin-right 和 margin-left auto。 然后我想,也许是右边的页脚,那里曾经有一个通讯框,正在强制占用空间,所以我把它划掉了,但仍然没有效果。任何人都知道可能是什么解决方案?非常感谢!

 .footer-container { width:100%; text-align: left;}
.footer { margin: 0 auto 0;width: 940px; padding: 0 20px 30px; background: #fff; }
.aditional-footer { margin:0 auto 0; padding: 30px 20px 35px; width: 940px; background: #FFF;}
.footer .links li { text-transform: none;}
.footer-container a { color:#666669; font-size: 9px; }
/*.footer-container .footer-right { width: 250px; }*/

.footer .f-left { width:520px; text-align: left;   margin: 0 auto;}
/*.footer .f-right { width:420px; text-align: right; }*/

这是 HTML

<html>
<div class="footer-container">
    <div class="aditional-footer">
        <?php echo $this->getChildHtml('bottomContainer') ?>
        <div class="f-right">
            <div class="footer-right">
                <div class="right-conteiner">
                    <?php echo $this->getChildHtml('newsletter') ?>
                    <div class="clear"></div>
                </div>
                <div class="right-conteiner">
                    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_time')->toHtml(); ?>
                    <?php if(themeOptions('topbtn')): ?>                    
                        <div id="back-to-top"><a href="#top" id="top-link"><?php echo $this->__('Back to top') ?></a></div> 
                    <?php endif; ?>
                    <div style="clear: both;"></div>
                </div>                
            </div>
        </div>

        <div class="f-left footer-left">
            <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_shipping')->toHtml(); ?>
        </div>
        <div style="clear: both;"></div>
    </div>  
</div>  
    <div class="footer">
        <?php echo $this->getChildHtml('bottomContainer') ?>
        <div class="f-left">
            <?php echo $this->getChildHtml('footer_links') ?><br />
            <?php echo $this->getCopyright() ?>&nbsp;&nbsp;
            <?php echo $this->getChildHtml('cms_footer_links') ?>
        </div>
        <div class="f-right">
            <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('verify')->toHtml(); ?>
        </div>
    </div>
</html>

【问题讨论】:

  • 它们是否是带有href的链接,它们应该在css中解决。尝试使用 .footer-container {text-align:center}。基于您的 html 应该类似于 的事实,其父 div 的宽度为:100%;这已经应用于页脚容器。也试试这个 footer{ margin: 0 auto;之后不要再放置 0。
  • 这两项更改均无效。即使他们这样做,对齐文本也只会对齐文本。不是整个div。然后,文本将位于 div 的中心,仍然在左侧。

标签: html css magento


【解决方案1】:

更改以下代码

.footer-container { width:100%; text-align: left;}

.footer-container { width:100%; text-align: center;}

如果您有任何疑问,请告诉我

【讨论】:

  • 不幸的是,这只会使 div 中的文本居中,而不是 div 本身:( 感谢您的输入
猜你喜欢
  • 2015-09-23
  • 1970-01-01
  • 2013-12-02
  • 1970-01-01
  • 1970-01-01
  • 2016-05-04
  • 2014-02-27
  • 2015-11-27
  • 2014-09-12
相关资源
最近更新 更多