How do I set this div's style in the style sheet?
开发者_StackOverflow社区<style type="text/css">
#[':0:adId'] { /* this does not work */
background:red;
}
</style>
<div id=":0:adId">Loading...</div>
Google Maps use this id format. How do i set the style?
You simply need to escape the :
with a \
:
<style type="text/css">
#\:0\:adId {
background:red;
}
</style>
You could do this with a attribute selector, like so:
div[id=":0:adId"] {
background: red;
}
This will not work in all browsers(you guessed IE), so you might have to include some javascript to do the trick there:
$('div[id=":0:adId"]').css({
background: '#FFF'
});
(Uses jQuery)
精彩评论