Sunday, 18 August 2013

Get value of attribute in CSS

Get value of attribute in CSS

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.

No comments:

Post a Comment