php - CSS通过包含查询字符串的id选择元素

标签 php css url css-selectors

我正在为网站设置主题 http://www.complementchic.com

所以在我的CSS中,我设置了主体的CSS来调整图像大小

http://www.complementchic.com/modules/vente_flash/flashSale.php

 #module-vente_flash-flashSale

但是当我通过页面切换语言时 php post url 变为:

http://www.complementchic.com/modules/vente_flash/flashSale.php?&id_lang=2

因此我在 css 中的 body id 更改为

 #module-vente_flash-flashSale?&id_lang=2

并且我无法在我的 CSS 样式表中使用此 ID -

那么,a) 有没有办法让我在样式表中使用此 ID 或解决此问题,

最佳答案

尝试使用 CSS 属性选择器:

HTML:

<body id="module-vente_flash-flashSale?&id_lang=2">
This is a text here
</body>

CSS:

body[id="module-vente_flash-flashSale?&id_lang=2"] {
  background-color: red; /* for example */
}

<强> jsBin 演示

关于php - CSS通过包含查询字符串的id选择元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13251007/

相关文章:

php - 将 cron 配置为每 15 分钟运行一次 URL

php - 不同的服务器,不同的数据类型,具有完全相同的代码

jquery - Toggle 类触发但没有发生任何更改

javascript - CSS+Javascript 交换不同的背景图片

javascript - jQuery 展开通配符选择器并保留内容

html - 通过电子邮件共享 url(自动捕获 url)

php - 如何在数据库中插入由 preg_match_all 获得的数组

python - Redis - 爬虫访问过的站点列表

url - 分层 URL 与平面 URL

php - 在 PHP 中合并 3 个数组