cube in center

by maxfloyd

HTML

<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
</head>
<body>
    <div class="main">
        <div class="b block1"></div>
        <div class="b block2"></div>
        <div class="b block3"></div>
        <div class="b block4"></div>
    </div>
    <div class="show"></div>
</body>
</html>

CSS

.main {
        display: flex;
        margin: auto;
        flex-direction: row;
        flex-flow: wrap;
        justify-content: center;
        border: 2px solid red;
        margin-left: 20px;
        margin-right: 20px;
        padding: 10px;
        }
        .b {
            height: 600px;
            width: 600px;
            margin: 5px;
        }
        .block1 {
            background-color: blue;
        }
        .block2 {
            background-color: rosybrown;
        }
        .block3 {
            background-color: green;
        }
        .block4 {
            background-color: orange;
        }
        .show {
            display: none;
        }
        .show-open {
            display: block;
            margin: auto;
            position: absolute;
            top:0;
            bottom: 0;
            left: 0;
            right: 0;
            height: 200px;
            width: 200px;
            background-color: black;
        }

JavaScript

$(function () {
            $('.block1').click(function () {
                $('.show').toggleClass('show-open')
            })
        });