954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Issue with ASP.net and CSS

Hi,
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!

Thanks!

kimmi_baby
Light Poster
40 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

ASP.NET isn't any different with CSS, because CSS is client side, ASP is server. Assuming your viewing in the same browser as the previous site was, the first thing I'd check is your css. Make sure you have all the relevant ids, classes, and tags. The best way I've found to center something, and this isn't perfect, is to give it a defined size with auto margins.

Fortinbra
Posting Whiz in Training
240 posts since Jan 2011
Reputation Points: 47
Solved Threads: 12
 

I have done that before, and never had a problem. all others styles got applied? is just that is not centered?

jbisono
Posting Pro in Training
442 posts since May 2009
Reputation Points: 71
Solved Threads: 59
 

How are you attempting to center it? Could you post a code example?

Fortinbra
Posting Whiz in Training
240 posts since Jan 2011
Reputation Points: 47
Solved Threads: 12
 

Use tag between body tag.

adobe71
Junior Poster in Training
56 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

No, do not use the tag, it has been deprecated and can cause unwanted behaviors in some browsers. It causes IE to switch into Qwirks mode which it tries to guess the standard by which your code is written and render accordingly, but it's quite often wrong.

It's best not to use any of the display tags in html, (), because these all have been deprecated and aren't supported in all browsers. Best practice would be to place any item you'd like affected in a or and use CSS to adjust the display properties of it.

Fortinbra
Posting Whiz in Training
240 posts since Jan 2011
Reputation Points: 47
Solved Threads: 12
 

Use the technique that Fortinbra said!!! using auto margins....

jbisono
Posting Pro in Training
442 posts since May 2009
Reputation Points: 71
Solved Threads: 59
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: