Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Keeping div content within body

    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.

  • #2
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Quote Originally Posted by newwebcoder View Post
    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

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have attached a .jpg file of the layout.

    Thanks.
    Attached Thumbnails Attached Thumbnails Keeping div content within body-layout.jpg  

  • #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,901
    Thanks
    46
    Thanked 202 Times in 201 Posts
    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?

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •