View Full Version : Issue with ASP.NET and CSS (layout isn't centered)

05-04-2011, 10:54 AM
I'm having a problem with an ASP.net website and CSS.

I've pasted my CSS code from a previous website (HTML and CSS) to have a look at it.
I've copied the basic divs etc into the masterpage.

But I'm finding that the layout isn't centered. The layout would normally be centered with a border but now it's actually positioned left. I've tried this with a few different stylesheets I had and I'm having the same problem.

Is there something special that needs to be done for ASP.net?

Any help would be appreciated!


05-18-2011, 09:09 PM
That sounds like a CSS issue. Do you have some code for us to look at?

In the CSS, try setting your main container div to margin: 0 auto 0 auto;

That will detect left and right margins and set them to be equal widths. This will center the div to the screen. Circumstances can change this however, but it's a good place to start.