View Full Version : IE page positioning problem

11-02-2010, 04:20 PM
I've had reports back from people viewing my site in Internet Explorer that the content is appearing half off the screen to the right. Does anyone know why it's doing this and can tell me the coding to fix it?


I'm looking for a way to centre my website on the screen, so an easy fix would be great. I'm very new to web design and trying to teach myself how along the way and am finding all the coding rather confusing, so any easy worded help would be appreciated.


11-02-2010, 05:08 PM
First, remove the html tags from your stylesheet

<style type="stretchy">
and I believe that your 'if IE 6' statement needs to go below all the other style statements.

11-02-2010, 05:50 PM
Thanks - I've moved the section of rules starting with the IE6 bit and they've all changed colour now to the proper css coding colours.

I'm running a subdomain version that I'm editing here.


In the coding for the IE6 bit - is any of that causing the glitch in IE6?
Is this line with the absolute positioning causing the problem?

#background { position:absolute; z-index:-1; }

When you say remove the html tags from my style sheet - where from? Do I need to edit the actual CSS page? Really confused about all this coding!

11-02-2010, 06:28 PM
OK, the if IE statement needs to be after the style closing tag on your page, not inside it. And yes, remove the html style tags from the actual style sheet.

11-02-2010, 06:32 PM
He means remove the following from your stylesheet:

<style type="stretchy">

11-02-2010, 06:42 PM
ok - I've noticed that the website is now sitting in the top left after modifying the CSS - the old version looked like it had a slight border around the edge. That's good isn't it?

I also tried copying the IE6 rules to below the style tag - but the text in Dreamweaver has now turned to light grey - is that right or does that mean it's not applying the rules?

11-02-2010, 06:45 PM
Light grey usually means you have a commented section. Move the IE6 statement below all the other style rules, but make sure you dont have */ after it.

11-02-2010, 06:57 PM
not sure what a commented section is - but its all modified on the sub domain now. I couldn't see any * in the code for the IE rules, the only / are in 1 rule referring to some CSS and the other is at the end - do I need that last style bit - or is the IE stuff not a style rule anyway?

<!--[if IE 6]>
<style type="text/css">
html { overflow-y: hidden; }
body { overflow-y: auto; }
#background { position:absolute; z-index:-1; }
#content { position:static; }

also, is anyone able to actually test this on a PC to see if it's still over to the right and 1/2 off the page? I can only test it on the mac version of IE, were it has always displayed fine.

11-02-2010, 07:06 PM

/*this is a comment section*/

The characters /* open a comment and the */ close a comment. Anything between these opening and closing characters are removed from any coding flow.

Also, yes your page is still way to the right in IE. You need to upload your css with whatever youhave changed. I still see the <style> tags in your css.

11-02-2010, 07:25 PM
I did modify the code/css pack too - but I'm making the changes to the sub domain site


that should have the modifications?

11-02-2010, 07:48 PM
You should fix the validation errors in your code as well. Validate here (http://validator.w3.org).

You have 63 errors, most of which is the use of characters such as "&" which are non web conformant and should be replaced, but some other errors as well that might be causing some issues with IE.

11-02-2010, 07:52 PM
a lot of the "&" symbols are in the javascript for my image rollovers on the menu bars - are they ok or do they need to simply be deleted from the code? Will the image rollovers still work if I do that?

<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

11-02-2010, 07:54 PM
Dont worry about the javascript errors, focus on the other errors. Then if there is still an issue, at least you know its not from incorrect code.