CSS selector match certain value in style attribute -
how can write css selector element specified inline styles?
for example:
<div style="top: 0; left: 0;">link1</div> <div style="left:3px; top:0;">link2</div> <div style="top:3px; left:0;">link3</div>
then, want select link1
, link2
since have top:0
.
i'm not sure if should place space in div[style*="top: 0"]
or not. how style attribute setted? browser format string in format automatically?
why need this: know query element based on style attribute not idea. i'm writing user style, while cannot modify html page or javascript. web page modified style attribute when events triggered.
since mentioned have no way change html, 1 hacky way can account both cases, guess:
div[style*="top: 0"], div[style*="top:0"] { /* styles here */ }
an alternative use js/jquery if willing.
example jquery:
$('div').filter(function() { return parseint($(this).css('top')) == 0; }).addclass("yournewclass");
edit: didn't notice mentioned cannot alter page via javascript well, well, leaving in in case.
Comments
Post a Comment