Valo cssLayout + margin: 0 auto

Hello,
I set up csslayout as main container, all content of page is in there. When i want to center it with this style, It is not working. When i was using reindeer theme everything was working fine. I checked with firebug and the code is there. Something I am missing? Sorry for my poor english.

CssLayout mainContainer = new CssLayout();
mainContainer.addStyleName("main-container");

.main-container {     
        width: 980px;                
        margin: 0 auto;        
 }

You need to make the .main-container a block element in order for auto margins to work. I think in Reindeer, CssLayout is set to a block element by default.

So try this:

.main-container {     
        width: 980px;                
        margin: 0 auto;
        display: block;       
 }

Thanks Jouni, it solved my problem.