Q:

Center Form Elements on Page with CSS

I've tried every way of centering elements in CSS that I know but I cannot get these form elements to center on the page.
My code: http://jsfiddle.net/VJLst/1/
<style>
#divQuizFillBlank {
    margin-left: auto;
    margin-right: auto;
}
#textQuizFillBlankUserAnswer {
    border: 2px solid #000;
    font-size: 16px;
    font-weight: bold;
    width: 80%;
    height: 40px;
    float: left;
    box-sizing: border-box;
    vertical-align: middle;
}
#buttonQuizFillBlankSubmit {
    border: 2px solid #000;
    font-size: 20px;
    font-weight: bold;
    width: 10%;
    height: 40px;
    float: left;
    margin-left: 5px;
}
</style>

<div id="divQuizFillBlank">
<input type="text" id="textQuizFillBlankUserAnswer">
<input type="button" id="buttonQuizFillBlankSubmit" value="&gt;">
</div>

A:

You need to set the width for #divQuizFillBlank.
The rule margin: auto; doesn't work for elements without a width. Moreover, it works only for block elements and those elements take up full available width.
#divQuizFillBlank {
    margin-left: auto;
    margin-right: auto;
    width: 80%;
}

Updated Fiddle: http://jsfiddle.net/praveenscience/VJLst/2/

