1.container {
2 width: 400px;
3 height: 300px;
4 background-color: #ccc;
5 position: absolute;
6 /*it can be fixed too*/
7 left: 0;
8 right: 0;
9 top: 0;
10 bottom: 0;
11 margin: auto;
12 /*this to solve "the content will not be cut when the window is smaller than the content": */
13 max-width: 100%;
14 max-height: 100%;
15 overflow: auto;
16}