【问题标题】:Attr not working [duplicate]属性不起作用[重复]
【发布时间】:2018-07-05 16:29:29
【问题描述】:

我正在尝试使用元素中的属性指定背景图像;像这样:

.gallery-tile {
    background-image: attr(data-thumbnail url, '');
}

虽然没有加载图像,但有人能够解释为什么这不起作用吗?我遵循了here 中的规范。

【问题讨论】:

    标签: html css attr


    【解决方案1】:

    注意:attr() 函数可以与任何 CSS 属性一起使用,但是 对内容以外的属性的支持是实验性的。

    https://developer.mozilla.org/en-US/docs/Web/CSS/attr

    这是一个实验性功能,唯一支持的属性是content。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-04
      • 2015-04-28
      • 2014-08-07
      • 1970-01-01
      • 2014-02-22
      • 2018-06-22
      • 2019-08-29
      相关资源
      最近更新 更多