首页
话题
动态
专家
文章
作者
公告
更多
积分规则
登录 或 注册
首页
话题
动态
专家
文章
作者
公告
积分规则
发表新帖
发表新帖
Is it possible to set the equivalent of a src attribute of an img tag in CSS?
后端
未结
关注
25
2572
借酒劲吻你
2020-11-22 09:30
Is it possible to set the
src
attribute value in CSS? At present, what I am doing is:
25条回答
野趣味
(楼主)
2020-11-22 10:04
Loading IMG src from CSS definition, using modern CSS properties
the empty
src
definition on an
triggers the onerror handler: loadIMG function
loadIMG function calculates the CSS value
strips all illegal characters
sets the IMG.src
when the CSS changes, the image is NOT updated! You have to call loadIMG again
JSFiddle: https://jsfiddle.net/CustomElementsExamples/vjfpu3a2/
0
讨论(0)
查看其它25个回答
发布评论:
提交评论
加载中...
验证码
看不清?
提交回复
热议问题