属性不工作
Attr not working
我正在尝试使用元素中的属性指定背景图像;像这样:
.gallery-tile {
background-image: attr(data-thumbnail url, '');
}
虽然没有加载图像,但有人能解释为什么这不起作用吗?我遵循了规范 here.
Note: The attr() function can be used with any CSS property, but
support for properties other than content is experimental.
https://developer.mozilla.org/en-US/docs/Web/CSS/attr
这是一项实验性功能,唯一支持的属性是 content
。
我正在尝试使用元素中的属性指定背景图像;像这样:
.gallery-tile {
background-image: attr(data-thumbnail url, '');
}
虽然没有加载图像,但有人能解释为什么这不起作用吗?我遵循了规范 here.
Note: The attr() function can be used with any CSS property, but support for properties other than content is experimental.
https://developer.mozilla.org/en-US/docs/Web/CSS/attr
这是一项实验性功能,唯一支持的属性是 content
。