我有一个设置为 100% 宽度的表格。我有时会添加一个带有 php 广告的随机 div。我希望广告 div 位于右侧和表格的内容中。我希望表格位于左侧,但仍处于 100% 左右,它将填充广告 div 左侧的所有空间。
简而言之,所以当 div 不存在时,表格将填充 100% 宽度。当 div 存在时,div 将位于表格的右侧,设置宽度为 300 像素。
这是 div 的样式
.ContentAds {
float: right;
height: 100%;
width: 300px;
display: block;
clear: none;
}
该表不是一个 div,而是简单地设置为 100% 宽度。
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><p class="Title">Title</p>
<p>This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content.. </p></td>
</tr>
</table>