Using :before CSS pseudo element to add image to modal -
Using :before CSS pseudo element to add image to modal -
i have css class modal absolutely positioned, z-indexed above it's parent, , nicely positioned jquery. want add together caret image (^) top of modal box , looking @ using :before css pseudo selector cleanly.
the image needs absolutely positioned , z-indexed above modal, haven't found way add together appropriate class image in content attribute:
.modal:before{ content:url('blackcarrot.png') /* class modalcarrot ??*/ } .modalcarrot{ position:absolute; left:50%; margin-left:-8px; top:-16px; } second best option- can add together styles inline in content attribute?
http://caniuse.com/#search=:after
:after , :before content okay use, they're supported in every major browser 5 versions back, except in ie, supported 3 versions safe utilize on browsers.
is you're looking for?
.modal:after{ content:url('blackcarrot.png'); /* class modalcarrot ??*/ position:relative; /*or absolute*/ z-index:100000; /*a number that's more modal box*/ left:-50px; top:10px; } .modalcarrot{ position:absolute; left:50%; margin-left:-8px; top:-16px; } if not, can explain little better?
or utilize jquery, joshua said:
$(".modal").before("<img src='blackcarrot.png' class='modalcarrot' />");
css modal-dialog pseudo-element
Comments
Post a Comment