Have you ever been working on a web form or aspx page, then on post back the background color just turns white?

That is due to two different issues from what I have seen. One of which is if you have HTML tags that are not in the proper format or not closing in the right order.

For example:

<body>
<form>
</body>
</form>

If you have any of that going on, fix it immediately. It is wrong to begin with and just because HTML and things like it are usually dealt with very laxly doesn’t mean it is okay to do it wrong. Every browser treats these kinds of mistakes differently.

The other problem that I have seen which is usually the main culprit is in the body tag. I don’t know when this was okay to do, but it isn’t supported anymore so it needs to be updated and stop doing it:

<body bottomMargin="0" bgColor="#ffffe0" leftMargin="0" topMargin="0" rightMargin="0" MS_POSITIONING="GridLayout">

The right way to do this is:

<body style="margin:0 0 0 0; background-color:#ffffe0;">

This is a problem I keep running into while working on older sites etc…

Leave a Reply

Your email address will not be published. Required fields are marked *