Link to home
Start Free TrialLog in
Avatar of Albert Van Halen
Albert Van HalenFlag for Netherlands

asked on

Parent div height

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

Avatar of elbrian87
elbrian87
Flag of United States of America image

Try using the code below to vertically center within divs:

Line-height: ##px;
ASKER CERTIFIED SOLUTION
Avatar of Albert Van Halen
Albert Van Halen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial