CSS - Centered Content Div Position Inconsistent
Hello!
I'm pretty new to CSS and to this forum, but I am having a problem with my website. My layout uses a centered content div using auto margins and all the positioning in the layout is done using relative positioning. The centered content div is 800px wide and is supposed to be centered in every page on the site. However, when I switch between certain pages on the site, I'll notice that the content div will shift a bit to the left. I've tried to trouble shoot this many times and can't seem to figure out what the problem is. Does anyone know how I can fix this? I wanted to post the website so you could see an example of the problem, but I'm not allowed to do so. It's not for self-promotion just so I can fix a problem. Anyway hopefully someone can help without seeing the site. Thanks! Similar TutorialsHi, I have 3 photos each with a credit (in text) beneath. I want them positioned relative to each other but to stay centered with the rest of the page. How do I wrap them? How do I position them? Hello I hope this isnt a stupid questions but here goes. I have a page designed with vertically centered content It works fine but if you view the page in a smaller screen size some of the content disapears in to the menu area of the browser. Its hard to explain but if you use the sorce code below and view it in any broswer. Make it so the browser is not maximized and then change the height of the window until the scroll bar appears ... you will notice that some of the conent goes into neverland before the srollbar appears. Line 1 disapears and can not be reads. This will be an issue for people viewing my site in 800x600 Thoughts? Code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style> #horizon { background-color: transparent; position: absolute; top: 50%; left: 0px; width: 100%; margin-top: -200px; text-align: center; min-width: 900px; } #wrapper { background-color: #fff; position: relative; text-align: left; width: 900px; height: 380px; margin: 0px auto; } </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <div id="horizon"> <div id="wrapper"> Line 1<br /> Line 2<br /> Line 3<br /> Line 4 </div> </div> </body> </html> Close this, wrong forum. Sorry! hi. I built a flash website with a resolution of 1920x1200. The background of this web is 1920x1200 and my actual website with menu and stuff is in the middle of it with a resolution of 1024x768. How can i upload this website and in the browser to shown always the middle of the flash? I hope this is possible. thanks! Hey, I'm a CSS noob, and I'm having some trouble with centering the content of my page. When I have the coding as an internal style sheet the page is centered, but when I put it in an external style sheet it looks the exact same...except for that it's left aligned. All I do is copy and paste it, but it change the layout around? Any tips? Good day, I have a problem, as everyone else does... Please look at the following code, I'll then explain what my problem is. <style>#menu{float:right;}</style> <div id=main> Main Content <div id=menu>Testing menu area</div> <div> ok... now, I want the menu to be floated right... with the content before the id=menu to be displayed on the left with respect to the menu... an easy solution to this would be: <div id=main> <div id=menu>Testing menu area</div> Main Content <div> ... however, I want the 'Main Content' to be before the id=menu div tag for SEO purposes. Thuis, my problem is, I cannot do it. The id=menu is displayed floating right BELOW the 'Main Content' information. This is a problem. I want it floated on the SAME level as the Main Content, but the 'Main Content' to be displayed before the id=menu... Any help? Sorry if this isn't clear, it's hard to describe, but I'm hoping some of you CSS genious's wilil be able to understand it and offer me some advice. Thanks I want a footer that's at the bottom of the page. If there isn't much content that means it should be at the bottom of the screen and there will be no scrollbars. If there is tons of content then it should show after the content and only be visible if the user scrolls to the bottom of the page. This code shows what I'm after and the problem I'm hitting. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>title</title> <style type="text/css"> body, html {margin: 0; padding: 0; height: 100%} #top {background: red; position: absolute; top: 0px; left: 0px; height: 50px; right: 0px;} #content {background: orange; margin: 50px 200px;} #leftNav {position: absolute; left: 0px; top: 50px; bottom: 50px; width: 200px; background: yellow} #rightNav {position: absolute; right: 0px; top: 50px; bottom: 50px; width: 200px; background: cyan} #bottom {background:green; position: absolute; bottom: 0px; left: 0px; height: 50px; right: 0px;} </style> </head> <body> <div id="content"> Content<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> </div> <div id="leftNav"> LeftCol </div> <div id="rightNav"> rightNav </div> <div id="top"> I'm at the top. </div> <div id="bottom"> I'm at the bottom. </div> </body> </html> Appreciate your thoughts. when i dont turn of cache in IE my website seems to forget some css rules half of the time its really annoying cause i only see it when i browse the site on the server not local...and only when caching is turned on i use the equal heights columns technique from positioniseverything.net the site having the problem is here the problem is visible on the home page....i think around 1/5th of the clicks... then the link in the top left content box that should be absolute; bottom:0; just crawls up to the text.... like my question is WHY?? does it only do it sometimes Hey, I am currently learning how to do layouts in pure CSS and am running into a few problems. Some of these i've cleared up, but i'm still learning obviously. My currently issue is that margin / top settings are not consistent throughout browsers. Example: in FF/Mozilla a margin setting or "top" pixel setting is "lower" than in IE. The reason for this is, apparantly, when margins are set to zero my lower div table actually rides up "under" the above div's bottom border, this creates an offset of 5 pixels when setting margins, etc. Whereas, in IE, the div sits directly beneath the 5px border, as I would assume it should. Here are the files i'm using: 1) Webpage: http://www.binjured.com/index2.php 2) CSS File: http://www.binjured.com/style2.css important css (as i see it) a #nav, .top, .main (these are all near the bottom of the file, if you wish to skip extraneous code). I am trying to understand WHY css does the things it does and how I can make it do the right thing. Any help would be extremely appreciated. Finally, there may be some extraneous code that those who know css, know does nothing. It's in there because I am trying to "debug" it but i'm completely lost for the answer now . ok at Rodoslovlje I have an issue. The menu on the left is most of the times longer then the right content part. Is there a way to fix that when this occurs I can make the right part move along without editing every page and hitting enter 20 times? Thnx Can someone look at my site at http://www.personalhurricanecenter.....com/index.php? using Internet Explorer? The problem is that on the initial load, the background of the main section (white in the middle) is fine, even though I had to drop the padding to 3em. You'll notice if you minimize and then maximize the window, resize it, or click on the "submit" button on the upper-right (which will redirect you back to this page) that the background turns blue. If you scroll down, then the lower portion is white. If you scroll back up, the background miraculously turns white again. But the section that remains visible during scrolling stays blue. Also, you can select the text in the blue and then deselect it and it'll be white! This does not occur in Netscape or Firefox. Can someone tell me what in the world is the deal? I've spent a week getting this layout set so I can move on and it's holding me up. Thanks. Tim P.S. I have my background color set to blue in the body section of my css, and the main background color set to white. Those are the only bg color configurations (except for link options). Hi, i have a weird problem when trying to set the background-color of a table using css. If i use the following code the table / cell displays fine: Code: .tabletop { border-width:1px 0px 0px 0px; border-style:solid; border-color:#666666; background-color:#8C9DA9; width:600px; } ...there is a 1px border at the top, and the background is coloured in. But if i remove the border, and just leave in the background colour like: Code: .tabletop { background-color:#8C9DA9; width:600px; } ...the background is no longer coloured! Can anyone explain why this is please? Cheers I have having issues with IE displaying my page wrong. The page is http://]http://tampabay-online.org/cetr/about.php (or any page within that site) and the css can be found at http://tampabay-online.org/cetr/cetr.css It displays fine in Firefox and Opera but IE makes the content class lower from the top than the #right navigation bar (they should both be 20 pixels form the top) Any help much appreciated. Code: .content { position:relative; width:320px; margin-left: 125px; margin-top: 20px; border:1px solid black; background-color:white; padding:10px; z-index:3; } #right { position:absolute; width:200px; top:20px; left:500px; border:1px solid black; background-color:white; padding:10px; z-index:1; } I have a site that I am working on: test dot choupique dot com The #subpage class is centered in internet explorer 9, but not firefox 5. I can't figure out why for the life of me. Can anyone see why? Thanks Hi there, sorry to bother y'all, but I've been fighting with this css for hours now and I can't seem to get it quite right. I'm trying to center a search box and button skinned with an image, which I think should be fairly simple, but I'm not very good with css yet and it's being more evil than usual. I will try my best to provide all the pertinent information, and thank you very much in advance for any assistance you might provide. My top bar is as such, at the moment (the current issue being that I can't get the text to not be on the edges with the image border while keeping the text field and the button flush against each other), although I've tried a number of other solutions, this is the closest as of yet that I have gotten. Code: <div class="header"> <div class="leftAlign"><a href="/Controller?pageRequest=home"><img src="/img/spinner.png"></img></a></div> <div class="rightAlign" id="topRight"> <jsp:include page="AccountLinks.jsp"></jsp:include> </div><br /> <form id="searchForm" action="/SearchServlet"> <input type="text" id="searchText"></input><input type="image" src="/img/searchButton.gif" alt="Search" id="searchButton"></input> </form> </div> and the relevant css is Code: div.header{ width: 1000px; margin: 0 auto; min-height: 60px; display: block; text-align:center; } div.leftAlign{ float: left; text-align: left; } div.rightAlign{ float: right; text-align: right; } #searchForm{ vertical-align: top; margin: 0; line-height: 1; outline:0; } #searchText{ background:url(/img/searchText.gif) no-repeat top center; padding:0px; margin:0; display:inline; border:0; width:159px; height: 31px; } #searchButton { background:url(/img/searchButton.gif) no-repeat top center; padding-top:0px; margin:0; display:inline; border:0; width:42px; vertical-align: top; line-height: 1; height:31px; } Any help that you can provide would be greatly appreciated. Thank you very much. http://www.lightblu.com/ (It speaks for itself) how come on my test page, http://www.lightblu.com/test.php works fine (ie. the menu is centered correctly), but not on the homepage? What did I do wrong? Ok, I give up... can't figure this one out... the navbar seems to be centered in IE but not in Firefox. www.moksha.net/index.html I notice that it doesn't seem to matter whether I am inside the header div or not. The navbar is a UL. I don't care how wide it is really... I would love to strip all this down to its most essential. Thanks! #header { padding: 1em; margin: 0px; text-align:center; width:100%; align: center; display:block; } #navbar { color:#FFCC33; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-decoration: none; margin:0 auto; } #navbar ul { clear:left; text-align: center; margin: 0 auto; list-style-type: none; text-indent: 0; width: 600px; background-color:#996633;} #navbar li { /* float:left; width:80px; */ padding-right: 1em; height: 3em; line-height:3em; font-size: 20px; display: inline; list-style-type: none; text-align: center; margin:0; } #navbar a { color:#FF9933; text-decoration: none; } #navbar a:hover { color:#FFCC33; } As a CSS beginner I want to change my few table based web sites to CSS based. Currently I may have a table with a border exactly fitting a graphic image... looks nice. Now I want that same image to fit perfectly in a CSS box in order to take advantage of all the extra features of color and border that comes with CSS. The problem is... nothing that I do will exactly fit the rectangular image in the CSS box. I have fooled with the dimensions of the box and image but somehow there is ALWAYS about a 4px edge of background at the bottom edge of the image. The left,top,right borders are exactly bordering the image as should be. Is this possible in CSS, I would like to follow the CSS way. #bottom_center { margin: 0px; padding: 0px; background: #ccc; width: 470px; height: 90px; border-style: ridge; } ---- then in the body ---- <div align="center"> <div id="bottom_center"> <img border="1" src="able_appraisal_web_logo.jpg" alt="Able Appraisal, Inc." width="470" height="90"> </div> </div> How can i accomplish this with CSS? See image he hxxp://g.imagehost.org/0398/css.png (replace x with t) |