www.webdeveloper.com
Results 1 to 6 of 6

Thread: Adapt the height of an element according to his wrapper height.

  1. #1
    Join Date
    Jan 2013
    Posts
    84

    Unhappy Adapt the height of an element according to his wrapper height.

    Hi, i want to know why this code wont work

    PHP Code:
    <head>
    <
    meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <
    style type="text/css">
    #wrapper{float:left}
    img{float:left}
    #text{float:left; border-right:1px solid black; height:auto; padding:10px;}

    </style>

    </
    head>

    <
    body>

    <
    div id="wrapper">

    <
    img src="http://3.bp.blogspot.com/-tPnVRHcTZ4A/Tbli9XhCnII/AAAAAAAAjeg/aZG5zXz7fDQ/s1600/tumblr_lk0jjkQ0zx1qds9mm.jpg"/>
    <
    div id="text">TEXT</div>
    </
    div>
    </
    body>
    </
    html

    My intention is to make the left-border of "text" id long such as the main wrapper height, that is conditioning essentially from the height of loaded image.
    Actyallu the height of the element is "static" and related to the text height itself.. Can be it fixed?

  2. #2
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    you mean the text is part of the picture?

  3. #3
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    change height: 100%; see if hat fixes it

  4. #4
    Join Date
    Jan 2013
    Posts
    84
    Quote Originally Posted by Nicholas Diaz View Post
    you mean the text is part of the picture?
    No, text is a separate div and i want that is assumes the height of the main wrap, or rather, the height of image


    Anyway i tryed with 100% but the problem perxists

  5. #5
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    When you float something, you take it out of the document flow. I don't see why you need to float your wrapper, but if you do, maybe throwing a div with a clear: both in there might help.

  6. #6
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    If that's the case and it's just text couldn't you just adjust the line height?

    Or will it need to be dynamic? Like the picture will change sizes or change pictures

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles