* {
    margin: 0;
    padding: 0;
}

.container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

.container .box {
    position: relative;
    float: left;
    width: 20px;
    height: 20px;
    border: 1px solid #000;
    display: block;
    background: #ff0;
}

.container .box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: rgba(255, 255, 255, .3);
    
}