We help IT Professionals succeed at work.
Get Started

Parent div height

1,069 Views
Last Modified: 2013-11-19
I have a layout where several controls are in.
My problem is that the controls, which are divs, are child elements of other divs.

Now, the parent div in which the controls are, don't get as high as the controls are; so the controls are over one another.
I can't specify the height since each control varies in height and I don't know how high a control will get on beforehand.

See the attached code.

I think I have to do something with the element which has the class toolboxItemContent but what...

Thanks
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>Layout test</title>
	<style type="text/css">
		INPUT[type=text], SELECT
		{
			width: 100%;
			border: 1px solid silver;
		}
		.toolboxItemGroup
		{
			border: 1px dotted black;
			display: block;
			padding: 5px;
			margin: 5px;
			min-height: 100px;
		}
		.headerText
		{
			border-bottom: solid 1px black;
			padding-bottom: 5px;
			margin-bottom: 5px;
			font-weight: bold;
			color: black;
			font-size: 11px;
			clear: both;
			text-align: left;
		}
		.toolboxItem
		{
			margin: 5px 0px;
			border: 1px outset silver;
		}
		.toolboxItemHeader
		{
			background-color: #CCC;
			padding: 0px 5px;
			display: block;
			height: 20px;
			position: relative;
		}
		.toolboxItemDesignerOptions
		{
			position: absolute;
			right: 2px;
			top: 2px;
		}
		.toolboxItem .toolboxItemContent
		{
			padding: 5px;
		}
	</style>
</head>
<body>
	<div class="toolboxItemGroup">
		<div class="headerText">
			My fields</div>
		<div class="toolboxItem">
			<div class="toolboxItemHeader">
				<span>First date</span> <span class="toolboxItemDesignerOptions">
					<img src="/Shared/Images/Options16.gif" class="options" title="Properties" />
					<img src="/Shared/Images/Close16.gif" class="remove" title="Remove field" />
				</span>
			</div>
			<div class="toolboxItemContent">
				<div id="ctl00_cphDetail_ctl01_dtpDate">
					<div style="padding-bottom: 2px; position: relative; width: 100%">
						<div style="width: 30%; left: 0px; position: absolute;">
							<label>
								Date</label>
						</div>
						<div style="right: 0px; position: absolute; left: 30%;">
							<div style="width: 100%; position: relative;">
								<div style="right: 25px; position: absolute; left: 0px;">
									<input type="text" id="ctl00_cphDetail_ctl01_dtp_Date_txtDate_dtpDate" name="ctl00$cphDetail$ctl01$dtp_Date$txtDate_dtpDate" />
								</div>
								<div style="right: 0px; position: absolute; text-align: right;">
									<input type="image" style="border-width: 0px;" src="/Shared/Images/Calendar16.gif" />
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="toolboxItem">
			<div class="toolboxItemHeader">
				<span>Rubricering</span> <span class="toolboxItemDesignerOptions">
					<img src="/Shared/Images/Options16.gif" class="options" title="Properties" />
					<img src="/Shared/Images/Close16.gif" class="remove" title="Remove field" />
				</span>
			</div>
			<div class="toolboxItemContent">
				<div>
					<div style="width: 30%; display: inline; float: left;">
						<label>
							Category</label>
					</div>
					<div style="width: 70%; display: inline; float: left;">
						<input type="radio" name="Category" value="1" />Category 1<br />
						<input type="radio" name="Category" value="2" />Category 2<br />
						<input type="radio" name="Category" value="3" />Category 3<br />
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>

Open in new window

Comment
Watch Question
Analyst developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE