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 5 of 5

Thread: Div help.

  1. #1
    Regular Coder syco__'s Avatar
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    194
    Thanks
    41
    Thanked 4 Times in 4 Posts

    Div help.

    Is there away to give one div height the value of another div area.
    say

    Code:
    height: #div2;
    so div area 1 is given the same height as div 2?
    .pLeAd InSaNiTy.

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    How you do it depends on the relationship between the 2 divs.

    You could do just

    Code:
    #div1, #div2 {
       height: 100px;
    }
    or if div2 is a child of div1 and the height of div1 is dynamic then you could use the inherit value for the div2 height.

    Post the html you have.

  • #3
    Regular Coder syco__'s Avatar
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    194
    Thanks
    41
    Thanked 4 Times in 4 Posts
    yeah but i want the parent to have the same height as the child is that possible? but it to be dynamic and change according to each page and what is in that childs div.
    .pLeAd InSaNiTy.

  • #4
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    No need to define height for parent DIV.. it ll automatically stretched according to its child DIV...

    If child div is floated element.. then you need to add overflow:auto property to parent DIV....

    Last edited by vikram1vicky; 08-28-2011 at 12:20 PM. Reason: typo

  • Users who have thanked vikram1vicky for this post:

    syco__ (08-28-2011)

  • #5
    Regular Coder syco__'s Avatar
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    194
    Thanks
    41
    Thanked 4 Times in 4 Posts
    Thanks its still not working 100% the way i want but i can work with it thanks for your help, your a good friend.
    .pLeAd InSaNiTy.


  •  

    Posting Permissions

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