html - 不能让两个 div 的高度相等!

标签 html css

我之前问过这个问题并被指向这个link ,我遵循并在我的 page 中实现了该技术:

注意旁边的公告 div 和 div。我希望公告 div 与其对应的高度相同。

我错过了什么?

最佳答案

将两个div的高度设置为相同

   <div class="announcement" style="position: relative; width: 728px; height: 200px;">  <!--This is the containing div position: relative to flow in sequence with the rest of the page.-->


   <div class="announcement" style="position: relative; width: 728px; height: 200px;">  
   <div style="position: absolute; top: 70px; left: 255px; width: 240px; background-color: azure;">
position: absolute; top: 70px; left: 255px; width: 240px; background-color: azure; overall width 248px including 2*3px padding and 2*1px border; (no height)
   </div>

例如将固定此 div 的高度,无论 div 中是否有一行或 5 行或任何此高度都将保持不变。

PK

关于html - 不能让两个 div 的高度相等!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3860413/

相关文章:

jquery - Div容器不以边距自动居中

Javascript/Jquery 链接更改表单下拉列表

css - 为什么我不能从 Chrome 的 userstylesheet Custom.css @import?

javascript - 断线测试

javascript - 根据文本更改背景

javascript - Div 出现在不同 div 的悬停上

html - 复制 wtikay - IE - currentStyle 在应该更新时没有更新

jquery - CSS 和 jQuery 简单问题

javascript - 从加载时生成的 <div> 中删除单词

javascript - 如何使图像半透明?