roondog Posted April 11, 2007 Share Posted April 11, 2007 (edited) Please post here any useful bits of CSS to help others over come those common problems. Please don't clutter this up criticising people's code as it will be harder for others to find the help they need. If you have problems with a piece of code start a new topic asking for help with it.I'll start with my solution to what seems to be the most common at the moment, centering a page. body {text-align: center; /* for aligning in IE less than or equal to 6 */}#divname {text-align: left; /* so the div won't inherit the text-alignment from the parent element */width: [color="red"]??[/color]px;margin: 0 auto; /* for the standards compliant browsers, such as Firefox, Opera, Safari, etc. */} You need to put all the content in to the div called 'divname' (most people call it container or wrapper) and use a valid doctype. The div must also have a width, replacing the '??' for this to work. This works for me in IE6, IE7, FF2 and Opera. Edited April 11, 2007 by Jonas Added some comments to the code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now