Jump to content

Wrapper fine in IE and Opera, not other browsers


Kingy

Recommended Posts

Hey guys, long time no speak. I'm updating my website and I've decided to give the whole Adobe Fireworks thing a go and try slicing with them instead.So I've put it all together and I've also written a simple little script to help center the browser.Basically the idea is if the screen size is over 1024 wide, it'll calculate the difference between your screenwidth and the 1100 pixel width of my design, then half it. Using that value I use position absolute and left of that calculated value to center the page.This appears to be fine in Opera in IE, however it still sticks left in other browsers, Chrome, Safari, and Firefox.I'm not sure if it's CSS or JavaScript in this particular case but I can't think of what the problem is because it should be really straightforward.Here's a link, I've made a temporary folder for it on my site, none of the links go anywhere apart from the twitter and deviantart link. It's work in progress. :)The JS:

function fixWidth(){if (screen.width>=1024){		var wrapper = document.getElementById("wrapper");	var myWidth = screen.width;	var fixWidth = ((screen.width - 1100)/2);	wrapper.style.position = "absolute";	wrapper.style.left = fixWidth;}}window.onload = function(){	fixWidth();}

The CSS:

@charset "utf-8";body {	font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;	background: #42413C;	margin: 0 auto;	padding: 0;	color: #000;	text-align:center;}a img {border: none;}#wrapper {text-align:center; margin:0 auto; padding: 0; width: 1100px; height: 1238px;}#wrapper img{margin:0 auto; padding: 0; border-collapse:collapse;}

http://www.kingmancheng.co.uk/v2/website_ver2.htmlI'm sure I'm overlooking or neglecting something simple per usual.And yes doctype is strict 4.01. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...