浮动左/右图像无响应

时间:2016-07-20 01:10:18

标签: html css

我有一个浮动左/右广告,宽度工作正常,但我无法弄清楚高度。

以下是我正在使用的代码:

<div id="leftads" style="max-width: 100%; height: auto; text-align:left; position:fixed; z-index:1001; bottom:1%;left:1%;">
  <div>
    <a href="#" id="adclose" style="color:#333333;font-size:13px;font-weight:bold;text-shadow:black 0.1em 0.1em 0.1em;padding-top:3px;padding-right:0px">
      <a href="" onclick="document.getElementById('leftads').style.display = 'none'; return false">[x] close ad</a>
    </a>
  </div>
  <!--Start Left Ad -->
  ad code
  <!--End of Left Ad -->
</div>
<div id="rightads" style="max-width: 100%; height: auto; text-align:right; display:scroll;position:fixed; z-index:1001; bottom:1%;right:1%;">
  <div>
    <a href="#" id="adclose" style="color:#333333;font-size:13px;font-weight:bold;text-shadow:black 0.1em 0.1em 0.1em;padding-top:3px;padding-left:0px">
      <a href="" onclick="document.getElementById('rightads').style.display = 'none'; return false">[x] close ad</a>
    </a>
  </div>
  <!--Start Right Ad-->
  ad code
  <!--End of Right Ad -->
</div>

1 个答案:

答案 0 :(得分:0)

如果要更改高度,可以指定高度。

  <div style="height:150px">left</div>
  <div style="height:150px">right</div>