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">&nbsp;</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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -