Hello, I have tried everything to get my entire site to center, can someone tell me what I am doing wrong? I am also using the 960.gs grid system for the site, but can't get it centered. you can see it live at: http://www.lincolnworks.com Thank you in advance
In order to center your page using CSS you can use "margin-left: auto; margin-right: auto;" for the main container. I noticed that in your code, you have three external CSS stylesheet that you wish to use. From what I can see, those stylesheets do not exist on your server.
Well, since I see deprecated tags, hordes of unnecessary elements, invalid forms, tables for layout, HTML 3.x markup inside your HTML4, and the telltales of some sort of nonsensical 'grid' design system (defeating the entire POINT of using CSS in the first place)... I'd chuck the whole thing and start over with semantic markup, separation of presentation from content, and in general MODERN coding technique instead of the oddball mix of styles you have which are for the most part a decade out of date.
Cant you put a div around the site and margin: auto; Im new to CSS so this could be wrong... but worth a try
plastickid: that will work, IF the new container is a static block (not float or pos: absolute etc) AND the new container isn't 100% wide AND the new container needs a width. However, often the existing elements on a page can be centered with the automargins, in general. Depends on what you're building.
Try this, it should work in every browser: html { text-align: center; } #container { margin: 0 auto; padding: 0 auto; width: 950px; } Code (markup): // You must have the main container with specific width.
margin: 0 auto on your container will work fine. That will center your entire layout on a page. Deathshadow, not everyone is an expert in CSS design. It may be more beneficial if you offer constructive criticism instead of badmouthing people's layout techniques.
i agree with deathshadow... there is no point in you using css when your code is "dodgy" i would go through the code remove all the html tables, and styling, then rewrite the whole site using css 1) be easier to find errors next time 2) be w3c valid if the code is all the same type e.g. all html 4 instead of html 3 & 4, then its going to mess up in certain browsers
The criticism is pretty much always a good thing, even if the author doesn't intend the code to be any good, or even if the author does want the code to be good but doesn't understand everything DS is talking about. And of course, there are many of us who, when seeing something poorly built, don't feel it's quite right to tell them how to fix their particular problem alone without comment. I mean, if this were a house that had all kinds of problems, and the builder asked how to fix like a window or something, many people would be happy to help with the window, while others of us feel that that would be kinda evil of us not to point out the defective foundation. Whether the builder agrees or not, we've then done our Good Deed for those extra karma points : ) That said, ds can sound pretty crusty. I think all his foul-mouthed criticism is actually constructive, because if the author is able to try to follow that advice, it's helpful and may end up with the Internets having a better page instead of a worse one. *edit hmmm, ds sounds a lot like Matt Trout (mst) from Shadowcat Systems.
There is a difference between being constructive and looking down on someone with less knowledge. I've been coding for 15 years since the days before Netscape 1 and when Mosaic was the browser of choice. I'm not tooting my own horn but I am light years ahead of anyone I work with except maybe 1 person at the University. That is well over 100+ people who develop web sites here. I've seen my share of crap design and I can talk just as much smack to them based on my knowledge. But I don't. I offer suggestions and keep the personal comments to myself. They add no value to finding a solution to the problem. His criticism can be harsh. Now granted the second part of his post is a constructive way of offering advice. But the first part is entirely unnecessary. I don't want to start a flame war because DS obviously knows his stuff and digs Looney Tunes. I'm just saying "Lighten up Francis." Just my 2 cents.
Then excuse me for saying what the **** business does someone lacking that skill have building a website in the first place? Bad code and sleazeball shortcuts are bad code and sleazeball shortcuts. The site was being built on some rubbish framework (most frameworks defeat the entire POINT of CSS in the first place), and for the most part it appeared that doveroh was being led down the garden path by decade out of date methodologies. Because frankly, if you don't know what's wrong with THIS in writing a new website: <center><b>Finding Jobs in Lincoln is Easy as...</b></center><P> <h4>   1) <a href=http://www.lincolnworks.com/myjobs/signup.php>SIGNUP FREE!</a><br>   2) <a href=http://www.lincolnworks.com/myjobs>Create or Upload a Resume</a><br>   3) <a href=http://www.lincolnworks.com/myjobs/search.php>Search For Jobs</a><br>   4) <a href=http://www.lincolnworks.com/myjobs/search.php>Apply to Jobs Easy</a><p> </h4><center> <b>Already Have An Account? </b> <br>Login Below!<br> <form action=http://www.lincolnworks.com/myjobs/login.php method=post> Username <input type=text name=username size=15><br> Password <input type=text name=password size=15><br> <input type=submit name=submit value=LOGIN></form> </center> Code (markup): Do the world a favor, back the away from the keyboard and take up something less detail oriented like macrame weaving. For those of you who don't know, the stuff with the bold and center at the top should be a heading tag, the numbered list should be a OL/LI set, the bold "already have an account" should be a heading tag, the 'login below' should probably be a legend, the text before each input should be inside a label, the contents of the form should be in a fieldset, only two of the break and NONE of the paragraph tags present are neccessary, there is rarely a need to ever use a non-breaking space, since the links are on the same domain there is no reason to state the domain on every anchor, none of the attribute values are properly quoted so that's HTML 3.2 not HTML4 (welcome to 1996), and the number of the heading makes little or no sense since there's no H1, H2 or H3 preceeding it. (honestly the 'top.png' I'd probably have as the H1) - and there is NO REASON TO EVER USE THE CENTER TAG. <h2>Finding Jobs in Lincoln is Easy as...</h2> <ol> <li><a href="/myjobs/signup.php">SIGNUP FREE!</a></li> <li><a href="/myjobs">Create or Upload a Resume</a></li> <li><a href="/myjobs/search.php">Search For Jobs</a></li> <li><a href="/myjobs/search.php">Apply to Jobs Easy</a></li> </ol> <form action="/myjobs/login.php" method="post"> <h2>Already Have An Account?</h2> <fieldset> <legend><span>Login Below!</span></legend> <label for="username"> Username <input type="text" name="username" id="username" size="15" /> </label><br /> <label for="password"> Password <input type="text" name="password" id="password" size="15"> </label><br > <input type="submit" name="submit" value="LOGIN"> </fieldset> </form> Code (markup): This is why my advice was chuck it and start over with MODERN coding techniques, instead of plodding along using code methods that were never actually valid or proper HTML, and haven't beed advocated by serious web developers for six or more years.