Div高度不会扩展到所有元素

时间:2013-04-17 18:27:07

标签: html css

我有一个div,我用它作为一个简单的模态弹出窗口。此div的高度设置为auto,但是当我查看它时,它不会一直向下扩展以覆盖其中的所有元素。关于如何使div高度覆盖所有元素的任何想法?

任何帮助都会受到赞赏。

谢谢,

这是html

<div id="basic-modal-content">
      <h3 id="eventtitle"></h3>
      <p>Below you will find information on the clicked event including a brief description, start date, and the end date, location, and a link, if provided.</p>
      <br />
      <code><span style="color:#A17E13"><b>Description</b></span> - <span style="color:#006400" id="eventdescription"></span></code>
      <code><span style="color:#A17E13"><b>Start</b></span> - <span style="color:#006400" id="eventstart"></span></code>
      <code><span style="color:#A17E13"><b>End</b></span> - <span style="color:#006400" id="eventend"></span></code>
      <code><span style="color:#A17E13"><b>Location</b></span> - <span style="color:#006400" id="eventlocation"></span></code>
      <code><span style="color:#A17E13"><b>Link</b></span> - <span style="color:#006400" id="eventurl"></span></code>

      <input type="button" id="deletecalendarentry" style="display:none" value="DELETE" />
</div>

这是css

#simplemodal-container {height:auto; width:auto; color:#006400; background-image:url(../Images/back.png); border:4px solid beige;  padding:12px;}

2 个答案:

答案 0 :(得分:2)

试试这个 jsFiddle

我已将您的CSS ID名称从#simplemodal-container更改为#basic-modal-content

这对我有用,所以如果你有任何问题,请告诉我。

答案 1 :(得分:0)

你可以给div一些最小高度

#div{min-height:50px;}