Code Snippet

Just another Code Snippet site

[CSS] Add Overlay around an element

HTML :

<div id="overlay" style='display:none'></div>

CSS :

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    filter:alpha(opacity=50);
    -moz-opacity:0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5;
    z-index: 10000;
}

.fieldToDisplay {
    z-index: 10001;
    position:relative;
}

JS to Show/Hide the overlay :

jq('#overlay').show();
jq('#overlay').hide();

,


Leave a Reply

Your email address will not be published. Required fields are marked *