body {
    margin: 0;
    background-color: #eee;
}

#container {
    position: relative;
    width: 600px;
    height: 600px;
    margin: 50px auto;
    background-color: white;
}

.square {
    position: absolute;
    width: 300px;
    height: 300px;
}

.red{
    background-color: red;
}

.blue {
    background-color: blue;
}

.tl {
    top: 0;
    left: 0;
}

.tr {
    top: 0;
    right: 0;
}

.bl {
    bottom: 0;
    left: 0;
}

.br {
    bottom: 0;
    right: 0;
}

.rect {
    position: absolute;
    width: 140px;
    height: 40px;
    background-color: red;
    z-index: 2;
}

.top-on-blue {
    top: 0px;
    left: 380px;
}

.bottom-on-blue {
    top: 560px;
    left: 80px;
}