Click here to Skip to main content
14,544,399 members

How to fix the height of the rowspaned TD in a table

charlesmu99 asked:

Open original thread
We are developing a HTML page like excel with HTML Table,user can merge some TDs in the rows or columns,in the merged TD, we insert some DIV for some purpose,this DIV's CSS uses the 'height: calc(100% + 6px)'.
Problem: when the size of chrome browser is changed,the the merged TD's height will change higher automatically.
we found that maybe it because the 'calc(100% + 6px)',but how to fix the TD's height? Thanks a lot!
some code like this:
<html xmlns="">

 <style type="text/css">
  html, body, form
   height: 100%;
   margin: 0;
   padding: 0;
#mainTable td>div{
	position: relative;
	left: -3px;
	top: 0px;
	width: -webkit-calc(100% + 6px);
	height: -webkit-calc(100% + 6px);
	width: calc(100% + 6px);
	height: calc(100% + 6px);
	border:1px solid blue;
	background-color: rgba(255, 255, 255, 0) !important;
	overflow: visible;
	/*overflow: hidden; */
#mainTable td>div>.borderControl{
	position: relative;
	left: 1px;
	top: 1px;
	width: -webkit-calc(100% - 2px);
	height: -webkit-calc(100% - 2px);
	width: calc(100% - 2px);
	height: calc(100% - 2px);
	border:1px solid red;
	box-sizing: border-box;
  -moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	overflow: hidden;
	border-collapse: collapse; 
	width: 500px; 
	height: 10px;
	table-layout: fixed;
#mainTable td>div>.borderControl>div{
	position: relative;	
	height: 0;
	width: -webkit-calc(100% - 3px);

  	border: 1px solid Silver;
	width: 100%;
	height: 100%;
	margin: 0px;
	padding: 0px;
	overflow: hidden;



 <table id="mainTable"  >
  	<td >  </td> 
    <td >  </td>
    <td >  </td>
  	<td >  </td>  
  	<td  rowspan="2" style="height:50px !important">
     <div ><div class="borderControl"><div></div><div class="widgetBox"></div></div><span></span><span></span><span></span><span></span></div>
  	<td >  </td> 

  	<td >  </td> 
  	<td >  </td>

  	<td >  </td> 
  	<td >  </td> 
  	<td >  </td> 


Tags: HTML5


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100