CSS background color not working

Try like this..

.question-template {
    width: auto;
    height: auto;
    background-color: blue;
    overflow:auto;
}

It's because both of your child elements are floated left. This means that the container won't stretch to the full height needed to contain the child elements.

To solve this you need to add a clearfix class such as this to your css:

.clearfix:after {
  content: "";
  display: table;
  clear: both;
}

And then add the class to your HTML like this:

<div class="question-template clearfix">

See here for more info: http://css-tricks.com/snippets/css/clear-fix/

Tags:

Css