我有一个< div>需要根据其中的内容进行自动调整。我如何做到这一点?现在我的内容是从< div>
我用于div的类如下
Box-centerside { background:url("../images/greyBox-center-bg1.jpg") repeat-x scroll center top transparent; float:left; height:100px; width:260px; }
解决方法
尝试使用以下标记,而不是直接指定高度:
<html> <head> <style type="text/css"> .Box-centerside { background:url("../images/greyBox-center-bg1.jpg") repeat-x scroll center top transparent; float:left; min-height:100px; width:260px; } </style> </head> <body> <div class="Box-centerside"> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> This is sample content<br /> </div> </body> </html>