div覆盖问题

zxcvbnmluton 2006-08-30 02:29:33
---------------------
| A | B |
---------------------

上面图示为一个表格A、B分别是单元格<td></td>
如果A和B中都有一个div分别是:
<div id="a" style="position:relative; width:200%">
<div id="b" style="position:relative; width:100%">
现在问题是div a是单元格两倍长
这样的话,div a会将div b覆盖掉
请问有什么方法让div b显示在div a下方,div b的左边与单元格B的左边框对齐。
谢谢!!
...全文
570 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hu_zy 2006-08-30
  • 打赏
  • 举报
回复
float:left;
试一下这个CSS
pli0825 2006-08-30
  • 打赏
  • 举报
回复
楼主,你的要求太奇怪了。为什么不能用其他的布局呢??

我只能改成这样
<table border="1" width="200" style="table-layout:fixed;">
<tr height="60">
<td width="100" valign="top">
<div style="position:relative;top:0;width:200;background:blue;">blue</div>
</td>
<td width="100" valign="bottom">
<div style="position:relative;top:0;width:100;background:yellow;">yellow</div>
<div style="position:relative;top:0;width:100;background:red;">red</div>
</td>
</tr>
</table>
ice_berg16 2006-08-30
  • 打赏
  • 举报
回复
<table border="1" width="200" style="table-layout:fixed;">
<tr height="60">
<td width="100">
<div style="position:relative;top:0;width:200;background:blue;">blue</div>
</td>
<td width="100">
<div style="position:relative;top:30px;width:100;background:yellow;">yellow</div>
<div style="position:relative;top:30px;width:100;background:red;">red</div>
</td>
</tr>
</table>
zxcvbnmluton 2006-08-30
  • 打赏
  • 举报
回复
谢谢.
to: pli0825(女儿当自强)
就是需要你代码显示的效果,我的代码如下,这两个必须要在相邻的单元格内(左右)
<table border="1" width="200" style="table-layout:fixed;">
<tr height="60">
<td width="100">
<div style="position:relative;top:0;width:200;background:blue;">blue</div>
</td>
<td width="100">
<div style="position:relative;top:0;width:100;background:yellow;">yellow</div>
<div style="position:relative;top:0;width:100;background:red;">red</div>
</td>
</tr>
</table>
pli0825 2006-08-30
  • 打赏
  • 举报
回复
楼主是要这个效果嘛??

<table>
<tr>
<td width="50px">
<div id="a" style="position:relative; width:200%;background:yellow;">a</div>
</td>
</tr>
<tr>
<td></td>
<td width="50px">
<div id="b" style="position:relative; width:100%;background:pink;">b</div>
</td>
</tr>
</table>
pli0825 2006-08-30
  • 打赏
  • 举报
回复
div a到没有把b覆盖掉,而是b把a长出来的地方覆盖掉了
一、在上下结构的div布局中,可能出现div覆盖div,但是内容却没有出现覆盖的现象。看看一个示例 1: 2: 3: 4: <em>DIV</em>与<em>DIV</em><em>覆盖</em> 5: 6: