这个意思?
<table border=1 style='width:100%; table-layout:fixed;'>
<tr>
<th colspan=2>我是标题</th>
<th rowspan=2 colspan=2>我是标题</th>
<th colspan=2>我是标题</th>
</tr>
<tr>
<th rowspan=2 colspan=2>我是标题</th>
<th>我是标题</th>
<th>我是标题</th>
</tr>
<tr>
<th colspan=2>我是标题</th>
<th colspan=2>我是标题</th>
</tr>
</table>
用css+div 可能要简单些
<table border=1 style='width:100%; table-layout:fixed;'>
<tr>
<th colspan=2>我是标题</th>
<th rowspan=2 colspan=2>我是标题</th>
<th colspan=2>我是标题</th>
</tr>
<tr>
<th rowspan=2 colspan=2>我是标题</th>
<th>我是标题</th>
<th>我是标题</th>
</tr>
<tr>
<th colspan=2>我是标题</th>
<th colspan=2>我是标题</th>
</tr>
</table>
用css+div 可能要简单些
解决方案 »
- CI里数组转换问题
- 以FastCGI方式运行的apache,是不是应该装 NTS版本PHP?
- WIN 2003 SERVER能否安装PHP开发环境? 有无关于PHP和SQL SERVER 2000数据库开发的书?
- 自己写一个PHP 转码函数
- 静态页面生成后,调用动态新闻显示列表,用js实现,是否可以说下原理,大家讨论下
- safari浏览器的困惑
- PHP CodeIgniter 时间相减 和 大小相减 疑问
- 聊天室的刷屏问题
- PHP缓存问题,非浏览器原因,非项目原因,悬赏值不是问题,求解答。
- 关于thinkphp默认路径的问题
- thinkphp中的js中如何识别foreach volist中的变量?
- 关于百度地图API
array('1x2', '我是标题'),
array('2x2', '我是标题'),
array('1x2', '我是标题'),
array('2x2', '我是标题'),
array('1x1', '我是标题'),
array('1x1', '我是标题'),
array('1x2', '我是标题'),
array('1x2', '我是标题'),
array('2x2', '我是标题'),
array('2x2', '我是标题'),
array('1x1', '我是标题'),
array('1x1', '我是标题'),
array('1x1', '我是标题'),
array('1x1', '我是标题'),
);
shuffle($ar);
$box = array(
array(1, 1, 1, 1, 1, 1),
array(1, 1, 1, 1, 1, 1),
array(1, 1, 1, 1, 1, 1),
);
$res = array();
foreach($ar as $ind=>$item) {
list($h, $w) = explode('x', $item[0]); //从左上角开始查找摆放的位置
$flag = 0;
for($y=0; $y<count($box); $y++) {
for($x=0; $x<count($box[$y]); $x++) {
if($box[$y][$x] == 1 && isset($box[$y+$h-1][$x+$w-1]) && $box[$y+$h-1][$x+$w-1] == 1) {
$flag++;
break 2;
}
}
}
if($flag) {
$res[$y][] = array('c' => $w, 'r' => $h, 'v' => $ind);
for($i=0; $i<$h; $i++) {
for($j=0; $j<$w; $j++) {
$box[$y+$i][$x+$j] = 0;
}
}
}
}echo "<table border=1 style='width:100%; table-layout:fixed;'>";
foreach($res as $row) {
echo '<tr>';
foreach($row as $cell) {
echo "<th colspan=$cell[c] rowspan=$cell[r]>{$ar[$cell['v']][1]}</th>";
}
echo '</tr>';
}
echo "</table>";