【问题标题】:CSS - Different Styles depending on different domainsCSS - 不同的样式取决于不同的域
【发布时间】:2014-09-17 06:37:39
【问题描述】:

我将根据域更改站点的样式。

Firefox-示例:

@-moz-document url-prefix("http//www.example.com") {
    body {
        background-color: rgb(176,230,230);     
    }         
}

是否有类似的东西适用于 Internet Explorer 和 Chrome?

问候

【问题讨论】:

  • 使用@-webkit-document for chrome
  • 你有例子吗?还是只是@-webkit-document url-prefix("http//www.example.com")...因为这行不通
  • @Stefan1988 检查this gist - 注意两个评论链接。
  • 已经用 JavaScript 函数解决了,因为我没有找到任何适合 IE/Chrome 的解决方案

标签: css internet-explorer google-chrome stylesheet


【解决方案1】:

您可以尝试基于 URL 的 CSS 文件。

如果您使用的是 RoR,则可以使用类似的方法。我相信其他框架也会有类似的东西。

- if (request.host == "http//www.example.com")
  = stylesheet_link_tag    "example", media: "all"
- else
  = stylesheet_link_tag    "application", media: "all"

【讨论】:

  • 不,我不使用 RoR,如果可能的话,我不想要几个 css 文件
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-04-04
  • 1970-01-01
  • 1970-01-01
  • 2015-09-22
  • 2021-07-07
  • 2011-06-05
  • 2023-02-13
相关资源
最近更新 更多