【问题标题】:Fancybox2 modify CSS of <body> by adding margin-rightFancybox2通过添加margin-right修改<body>的CSS
【发布时间】:2013-02-27 16:50:45
【问题描述】:

我正在尝试在我的网站上使用 fancybox2,当我使用 fancybox 链接 (Firefox) 时,我的页面一直向右移动。根据我所读到的内容,我可以通过更改 fancybox css 来修复它,但我不会成功。

我有:

body{
    width: 1024px;
    margin: auto; !important;
}

当使用fancybox时,它得到(从萤火虫看到):

<body style="margin-right: 0px;">

我尝试更改 css 行:

.fancybox-lock {
    overflow: auto;
}

.fancybox-lock .fancybox-overlay {
    overflow: auto;
    overflow-y: scroll;
}

但这并不能解决问题。

对此的任何帮助将不胜感激!

【问题讨论】:

  • 为什么不使用通用包装容器而不是对body 标签应用维度? (你会省去很多麻烦;)
  • 你说的太对了。这解决了我的问题,虽然我从来不知道在 Body 上应用一些 CSS 是一个坏习惯!谢谢我学到了一些东西,它解决了我的问题:)

标签: jquery css firefox fancybox-2


【解决方案1】:

使用 !important 时,它应该放在值旁边,而不是分号后面。

这是错误的:

margin: auto; !important;

这是正确的:

margin: auto !important;

希望这能让您更接近解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-02
    • 1970-01-01
    • 2014-05-16
    • 1970-01-01
    • 2012-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多