Project

General

Profile

CSS "margin: 0 auto;" doesn't work?

Added by Smitty . over 14 years ago

I'm trying to center my interface with CSS, but it seems like it doesn't recognize "margin: 0 auto;"

Here is my CSS:

.container {
    width: 60%;
    margin-top: 1em;
    margin-left: auto;
    margin-right: auto;
}

And in my init code I am doing:

useStyleSheet("/cgi-bin/calc/style.css");
root()->setStyleClass("container"); // I also tried '.container'

I'm sure the file path is right because I am able to set the width of the

. I don't know what I'm doing wrong.