2013-04-20 74 views
0

我目前有一个设置为width: 153px;height: auto;的框,但是当页面加载时,因为它没有任何内容,它没有任何主体。如何设置像素高度然后自动设置

我该如何加载高度:51px,然后在添加图像后改为自动?

我试过了什么?

我尝试使用height: 53px auto;
设置在HTML中的DIV的高度。

我确定它很简单,但我似乎无法解决它。任何帮助表示赞赏,我感谢你的时间。

回答

1

这是无效的!

height: 53px auto; 

使用这种方式:

height: 53px; 
height: auto; 

相反,你可以有一个min-height并将其设置为53px

min-height: 53px; 
height: auto; 
+0

我试过,以及它只是使用自动高度和53不起作用。 'div#pricebox5 { border:1px solid#E1E1E1; 背景:白色; width:153px; height:53px; 身高:自动; }' – 2013-04-20 04:06:52

+1

@KennenLasuni现在查看我更新的答案... :)使用第二种形式。 – 2013-04-20 04:07:17

+1

ahhh谢谢! :) – 2013-04-20 04:09:04

0

使用

min-height: 53px; 
height: auto