HTML example:
<div data-style-top="20%">Hi, I'm not so high right now.</div>
Here, I want the div with 'data-style-top' attribute which is set to '20%' to have a css property of top:20%; If the attribute value was 50% then top property should have the value '50%'.
Any ways to achieve this? Like:
div[data-style-top]:before {
top: content(attr(data-style-top));
}
Sorry if I couldn't explain properly. I suck at explaining.
$('[data-style-top]').data('style-top')attr()value for another property thancontentis part of a CSS3 module (for now) but is unsupported (for now). Source: MDN (edit: comment in bugzilla says it should work in IE9+. Can't test this today)