html - Css target custom inline tag -
i wondering if possible targeting element css via it's attributes. fo example, can target current_room
value 1
css?
<body id="id-43" current_room="1"> </body>
i tried this, none of them worked:
body[attribute = value] body[current_room = 1] { pointer-events: none; }
i not want target id
giving suggestion, have reasons.
your last selector correct, need remove space, body
holds attribute, , wrap value in quotes:
body[current_room="1"] { background-color: #dcc; }
<html> <body current_room="1"></body> </html>
however should noted current_room
not valid attribute body
element, , such making html invalid may have unforeseen effects in browsers. using data-*
attribute fix issue.
Comments
Post a Comment