george Posted May 22, 2008 Share Posted May 22, 2008 I want my page to be a fixed width, such that when the browser window is made smaller, the contents do no wrap around. So far in my attempts I have tried: #bodyWidth { position:absolute; width:1024px; } Where <body><div id="bodyWidth">stuff</div></body> But my browser does not seem to understand what I am trying to do. What am I missing here? Link to comment Share on other sites More sharing options...
george Posted May 22, 2008 Author Share Posted May 22, 2008 I got it to work by changing my element attributes #bodyWidth { position:absolute; top:0px; left:0px; right:0px; width:1024px; } But why did this do it? And is there a better way? Link to comment Share on other sites More sharing options...
newseed Posted May 22, 2008 Share Posted May 22, 2008 Remove the position: absolute. Link to comment Share on other sites More sharing options...
george Posted May 22, 2008 Author Share Posted May 22, 2008 Remove the position: absolute.I tried it originally with just the width attibute. I commented it out, as you suggested, and it did not work. Put it back in, and it did. I think in this instance, the width needs something more to tell it, wide from where, wide to where, and to distinguish it from a relative where to an absolute where. Worked for me. Cheers Link to comment Share on other sites More sharing options...
newseed Posted May 22, 2008 Share Posted May 22, 2008 Of course I don't know what browser you are using but it does work without position absolute in IE, FF, Netscape, Opera and Safari. Have you tested your code by itself in multiple browsers or did you test it in conjuction with other codes? Link to comment Share on other sites More sharing options...
george Posted May 23, 2008 Author Share Posted May 23, 2008 Have you tested your code by itself in multiple browsers or did you test it in conjuction with other codes?I am only testing with IE 7. The only browsers that will be accessing this site will be using IE 7. #bodyWidth { position:absolute; top:0px; left:0px; right:0px; width:1024px; } When I comment out position:absolute; it no longer works. I do want an absolute width, so that with a smaller resolution, overflow will go off screen. I could try it in Firefox, but I wont. Not cost effective. Link to comment Share on other sites More sharing options...
newseed Posted May 23, 2008 Share Posted May 23, 2008 Don't forget to remove the postions top:0px; left:0px; right:0px; Link to comment Share on other sites More sharing options...
nhaskins Posted May 27, 2008 Share Posted May 27, 2008 try adding min-width: 1024; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.