[css] CSS: Set a background color which is 50% of the width of the window

The most bullet-proof and semantically correct option would be to use fixed-positioned pseudo-element (::after or ::before). Using this technique do not forget to set z-index to elements inside the container. Also mind, that content:"" rule for pseudo-element is needed, otherwise it won't get rendered.

#container {...}

#content::before {
    content:"";
    background-color: #999;
    height: 100%;
    left: 0px;
    position: fixed;
    top: 0px;    
    width: 50%; 
    z-index: 1;
}


#content * {
  position: relative;
  z-index:2;
}

Live example: https://jsfiddle.net/xraymutation/pwz7t6we/16/