2 replies [Last post]
arzo2000
arzo2000's picture
User offline. Last seen 3 years 13 weeks ago. Offline
rank Regular
Regular
Timezone: GMT-4
Joined: 2005-07-07
Posts: 12
Points: 0

I got a problem with DIVs inside a table. I need the DIV to stretch 100% height in a table cell. But here, the result is a cut off DIV at the bottom.

Any suggestions?

HTML

<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<LINK HREF="PANELS.css" REL="stylesheet" TYPE="text/css" MEDIA="screen" />
</HEAD>

<BODY>
<TABLE CELLPADDING="0" CELLSPACING="8" BORDER="0" WIDTH="100%" HEIGHT="100%">
	<TR>
		<TD>
			<DIV ID="P_MAIN">
				<SPAN ID="P_HEADER">Header</SPAN>
				<SPAN ID="P_CONTENT">Content</SPAN>
			</DIV>
		</TD>
		<TD>
			<DIV ID="P_MAIN">
				<SPAN ID="P_HEADER">Header</SPAN>
				<SPAN ID="P_CONTENT">Content</SPAN>
			</DIV>		
		</TD>
	</TR>
	<TR>
		<TD>
			<DIV ID="P_MAIN">
				<SPAN ID="P_HEADER">Header</SPAN>
				<SPAN ID="P_CONTENT">Content</SPAN>
			</DIV>
		</TD>
		<TD>
			<DIV ID="P_MAIN">
				<SPAN ID="P_HEADER">Header</SPAN>
				<SPAN ID="P_CONTENT">Content</SPAN>
			</DIV>		
		</TD>
	</TR>	
</TABLE>
</BODY>
</HTML>

CSS

html, body{height:100%;}

body {
	min-height: 100%;
	padding:0;
	margin:0;
	color: #333333;
}

#P_MAIN {
	width: 100%;
	height: 100%;
}

#P_CONTENT {
	width: 100%;
	height: 100%;
	background-color: #FFFFFF;
	border-left: 1px SOLID #CCCCCC;
	border-right: 1px SOLID #CCCCCC;
	border-bottom: 1px SOLID #CCCCCC;	
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;	
}

#P_HEADER {
	background: #CCCCCC;
	width: 100%;
	height: 20px;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: bold;
}

drhowarddrfine
drhowarddrfine's picture
User offline. Last seen 9 weeks 6 days ago. Offline
rank Leader
Leader
Timezone: GMT-6
Joined: 2005-05-21
Posts: 764
Points: 0

DIV inside TABLE

First, do not view your code in IE because IE will screw you up. Use Firefox for initial design.
Second, you need a proper doctype to keep all browsers using the same set of 'rules'. You'll see the IE behavior change when you do. Right now FF and IE display your code differently.
Third, use lower case in your tags.

IE7 is 10 years behind the standards or wrong.
But it works in IE!
IE is a cancer on the web -- Paul Thurott

drhowarddrfine
drhowarddrfine's picture
User offline. Last seen 9 weeks 6 days ago. Offline
rank Leader
Leader
Timezone: GMT-6
Joined: 2005-05-21
Posts: 764
Points: 0

DIV inside TABLE

Also, validate your code. You have multiply defined 'id's. An id is only allowed once per page. If you must use the same name for each element, use 'class'.

IE7 is 10 years behind the standards or wrong.
But it works in IE!
IE is a cancer on the web -- Paul Thurott