...

View Full Version : Keeping div content within body



newwebcoder
08-06-2011, 07:42 PM
I am a long time programmer but fairly new to web programming.

I am organizing a web page using divs and css. I am trying to keep the content of a div (placed on the right side of the body) to stay within the bordered body. I would rather not hard code the size of the div, but let the contents of the div fill to the right and down to the body borders.

body {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;

border-width:1px;
border-style: solid;
}

However, all my attempts have the contents of my div go outside the borders of the body on the right and the bottom.

Any help is appreciated.

vikram1vicky
08-06-2011, 08:16 PM
I am a long time programmer but fairly new to web programming.

I am organizing a web page using divs and css. I am trying to keep the content of a div (placed on the right side of the body) to stay within the bordered body. I would rather not hard code the size of the div, but let the contents of the div fill to the right and down to the body borders.

body {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;

border-width:1px;
border-style: solid;
}

However, all my attempts have the contents of my div go outside the borders of the body on the right and the bottom.

Any help is appreciated.


Share the mockup (layout image) how u want your page will look :)

newwebcoder
08-06-2011, 09:58 PM
I have attached a .jpg file of the layout.

Thanks.

alykins
08-07-2011, 01:03 AM
However, all my attempts have the contents of my div go outside the borders of the body on the right and the bottom.


it is bc you are setting the body to have a positioning attribute of absolute and removing it from normal flow... is the position attribute necessary?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum