hacknorris
here is my full code : https://pastebin.com/aYQtaSy3
and question outside code but related is: how can i make a custom html element with a custom data-\* attribute having img link?
html is this:
```
<app-icon data-href="pinky-kde.gif"></app-icon><app-name>test</app-name>
```
yes i see `<app-name>` test content with no bugs, unlike `<app-icon>`.
like these codes do nothing at all:
```
app-icon::before{
display: inline-block;
content:attr(data-href url);
}
```
```
app-icon{
display: inline-block;
content:attr(data-href url);
}
```
```
app-icon{
display: inline-block;
content:attr(data-href url);
max-height: auto;
max-width: auto;
height: 100%;
width: 100%;
}
```
and this one displays url of image instead of image:
```
:root{
--icon: attr(data-href);
}
app-icon::before{
display: inline-block;
content: var(--icon);
}
```
any ideas? i think i tried half of regular stackoverflow without any result...
Top Answer
Jack Douglas
this isn't to do with custom elements
Your CSS doesn't work even with normal elements like `<span>`, because the "with type" syntax of `attr`, `attr(src url)` [is not supported on any current browser](https://developer.mozilla.org/en-US/docs/Web/CSS/attr#browser_compatibility).
The spec for `attr(src url)` is part of [CSS Values and Units Module Level 5](https://w3c.github.io/csswg-drafts/css-values-5/#attr-notation) (currently [Editor's Draft](https://stackoverflow.com/a/7661387/12757754)). It was previously in CSS Values and Units Module Level 3 but has been punted. Neither the [Mozilla bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1448252) nor the [Webkit bug](https://bugs.webkit.org/show_bug.cgi?id=26609) suggest the feature is currently being worked on.
In short: don't hold your breath.