SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast jumboshrimp's Avatar
    Join Date
    Aug 2007
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making parent div adjust for children

    The issue i'm having is that if i change the padding of children elements.. those elements spill out of the parent. is there a way to make the parent adjust it's dimensions?

    thanks for the help!

  2. #2
    Non-Member
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    4,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    without any code it's a guess use float ?
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>12345 12345 12345 12345 12345</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    	<!-- saved from url=(0022)http://www.domain.com/ -->
    	<style type="text/css">
    	.a{
    	background:#ffffcc;
    	float:left;
    	}
    	
    	.b{
    	width:20em;
    	padding:1em;
    	margin:2em;
    	background:#ccffcc;
    	}
    	</style>
    	<script type="text/javascript">
    
    	</script>
    </head>
    <body>
    
    <div class="a">
    
    <div class="b">some text</div>
    
    </div>
    
    </body>
    </html>

  3. #3
    SitePoint Enthusiast jumboshrimp's Avatar
    Join Date
    Aug 2007
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's something like this
    PHP Code:
    <div id="container">
       <
    span style="padding:20px;">some text</span>
    </
    div
    what's happening is that the container div's height, is the height of the text.. it's not adjusting for the padding that is on the child span element

  4. #4
    Non-Member
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    4,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    a span is inline , try it with padding 20px on the container also, or make the span display:block;

  5. #5
    SitePoint Enthusiast jumboshrimp's Avatar
    Join Date
    Aug 2007
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all4nerds, thanks for the help,

    i don't want/need padding on the container and making the spans block wont work because i have more than one span in that container div and they need to be inline..


Bookmarks

Posting Permissions

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