Jump to content

Fixed Width


george

Recommended Posts

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

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

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

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

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

Archived

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

×
×
  • Create New...