I already have a website but need it to be centered. It uses CSS and DIVs, but I dont know how to center it. The URL is: hookahloungestore.net Let me know how to center it and I will send you $20. Thanks
Simple put all your content (header, body, footer) into 1 div with an ID of 'container'. And then add this to your stylesheet You may need to adjust width slightly.
Start by using a complete and proper DOCTYPE on your pages (directly above the opening <HTML> tag), and make sure that nothing is above it - not even white space. Given that you don't have a DOCTYPE at all, I'd go with HTML 4.01 Transitional here. !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Code (markup): Then apply a margin of 0 auto and a width to your BODY selector in your stylesheet. Here's an example: body { margin: 0 auto; width: 990px; } Code (markup): Though honestly, I'd re-write that site template from scratch to get the most out of clean, minimal, semantic and valid markup possible that can also survive various site designs. If you don't know how or want to do this yourself, consult a professional Web developer who knows what he or she is doing for a consultation and/or a quote.
the site software is bought, and it is a good amount of work to fix those things that you said, but if i find someone to do it , I will definitely hire them to do so... Nima
Nima, what software are you using for the site? It shouldn't be that hard to change a single template file to include the DOCTYPE, and then edit the stylesheet. (As far as a quick fix goes anyway - which is what my earlier post was mainly about; the deep cleaning can come later.)
It "messed everything up" because you're currently depending on the browsers to guess what you want them to do instead of explicitly telling them what they should do in the first place. In other words, the browsers are relying on their error handling techniques instead of doing the right thing the first time around. If you don't want to correct what the browsers are doing, wrap everything inside the BODY tags in a DIV, then apply the width and text-align: center; to the BODY, and text-align: left; to the DIV. You'll still be relying on the browser quirks, but it will act as a "band-aid" until the site can be re-coded properly.