Centering with Absolute in CSS
There is a clever way to center an element using absolute positioning. You can make it so that the element is placed exactly in the center of the browser window. To do this, you do not specify the dimensions of the element and at the same time specify the positioning on all four sides:
<div id="elem"></div>
#elem {
position: absolute;
top: 30px;
right: 30px;
bottom: 30px;
left: 30px;
border: 1px solid green;
}
:
Using the described method, create a block located in the center of the screen and indented on all sides by 100px.
Using the described method, create a block that is indented from the top edge of the screen by 100px, from the right by 200px, from the bottom by 50px, and from the left by 10px.