Issue
I have this HTML code:
<div data-width="70"></div>
I want to set it's width in CSS equal to the value of data-width attribute, e.g. something like this:
div {
width: [data-width];
}
I saw this was done somewhere, but I can't remember it. Thanks.
Solution
This is what I was looking for:
https://developer.mozilla.org/en-US/docs/Web/CSS/attr
The problem is that at this time of writing it's not supported even by some of the major browsers (in my case Chrome):
Answered By - Amar Syla

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.