I'm having an issue with a DIV on my webpage that is centered using margin-left and margin-right set to auto. When I try to resize the DIV, it no longer stays centered on the screen.
<div id="content" style="margin-left:auto;margin-right:auto;width:240px">
<p>Lots of text</p>
</div>
Elsewhere in the code:
$("#content").width(480);
After resizing, the div becomes unbalanced either to the right or left. How can I make sure that the margins adjust accordingly when the width changes, while still maintaining center alignment? This needs to work across all modern browsers.