gpt4 book ai didi

无法通过 img 元素上的类应用 CSS 属性

转载 作者:行者123 更新时间:2023-11-28 00:10:46 24 4
gpt4 key购买 nike

我正在尝试通过 class 属性应用一些 CSS 样式。不知何故,这是行不通的。

它直接通过样式属性工作:

<img class="listImage lazy" style="max-width: 100%; height: auto; width: auto\9; /* ie8 */" .. >

它不能通过类属性工作:

.listImage.lazy{
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}

这一个都不是:

.listImage.lazy{
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}

如何将样式应用于类 listImage?

最佳答案

您可以像这样简单地将样式应用于类 listImage:

.listImage {
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}

如果你想为你的两个类添加相同的样式,那么你需要这样写:

.listImage, .lazy {
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}

请注意,您将类 listImage 和类 lazy 分配给了您的 img 标签。

关于无法通过 img 元素上的类应用 CSS 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55412793/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com