Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a hole in a <div> element

Tags:

html

jquery

css

Definition of Hole in a div - An element or a method by which you can show the background, only for a particular area, behind the content of a <div> element.

like image 622
Sussagittikasusa Avatar asked Dec 03 '10 11:12

Sussagittikasusa


People also ask

How do I make a hole in CSS?

To bold text simply for decoration, use the CSS font-weight property instead of the HTML strong element. Let's say you want to bold a word in a paragraph — you'd wrap the word in <span> tags and use a CSS class selector to apply the font-weight property to the specific span element only.

How do you cut border in CSS?

Here is another approach using CSS transform: skew(45deg) to produce the cut corner effect. The shape itself involves three elements (1 real and 2 pseudo-elements) as follows: The main container div element has overflow: hidden and produces the left border.


1 Answers

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

like image 56
equinox Avatar answered Sep 19 '22 01:09

equinox