CSS Frontend UI/UX

Creating a hole in a Div element

Box shadow support almost all modern browsers, so, you can do what you want (I hope, I understood you right) this way:

html:

<div class="hole"></div>

css:

.hole {
    position: absolute;
    left: 50px;right: 50px;width: 50px;height: 50px;
    box-shadow: 0 0 0 99999px rgba(0, 0, 0, .8);
}

So, the block will be transparent, and all around it will be hightlighted with its shadow.

Example: http://codepen.io/anon/pen/ultKh

You may also like...

2 Comments

  1. Antonio Cholony says:

    Thanks alot.

    1. Coneits-RS says:

      you’re welcome

Leave a Reply

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