【问题标题】:css margin:0 auto does not work in firefoxcss margin:0 auto 在 Firefox 中不起作用
【发布时间】:2014-02-16 19:21:38
【问题描述】:

请在不同的浏览器中查看下面的链接。
http://www.bayaneqalam.com
在 Chrome 和 IE 中,底部徽标滑块位于页面中心。但它在 Firefox 的右侧。这个问题有什么用?
我已经为这个滑块使用了 carouFredSel

【问题讨论】:

标签: css slider margin center caroufredsel


【解决方案1】:

您是否检查过 Firebug 上应用的样式? .caroufredsel_wrapper 元素中添加了一些内联样式,在某些情况下这些样式没有任何意义。

顺便说一句,样式中没有margin: 0 auto; CSS 声明。这是我从 Firebug 中得到的:

element.style {
    bottom: auto;
    display: block;
    float: none;
    height: 100px;
    left: auto;
    margin: 0;        /* <-- the margins of all 4 aspects have been set to 0  */
    overflow: hidden;
    position: relative;
    right: auto;
    text-align: center;
    top: auto;
    width: 740px;
    z-index: auto;
}

IMO,您可以在 CSS 文件中某处的元素上应用 margin,并确保它覆盖内联样式,如下所示:

.caroufredsel_wrapper {
    margin: 0 auto !important;
}

【讨论】:

  • 谢谢哈希姆。您的代码的第二部分解决了问题。
猜你喜欢
  • 2016-06-19
  • 2014-12-24
  • 2015-07-09
  • 1970-01-01
  • 2012-05-06
  • 2011-03-11
  • 1970-01-01
  • 1970-01-01
  • 2015-10-24
相关资源
最近更新 更多