开发者

How to set height auto CSS property?

开发者 https://www.devze.com 2023-03-22 16:46 出处:网络
This is a CSS question in asp.net. I have a page which is surrounded by container div. This contains div#contenthome, with div#flashhome inside it.

This is a CSS question in asp.net.

I have a page which is surrounded by container div. This contains div#contenthome, with div#flashhome inside it.

#Container and #contenthome height property is set to auto. But when I increase #flashhome height, #container and #contenthome height is not changed accordingly. How can I achieve auto increase and decrease of #container and #contenthome heights depending on #flashhome height.

#container 开发者_Python百科{
    width: 750px;
    height: auto;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    border:1px;
    border-color: #b7b7b7;
    border-style: solid;
}
#contentHome {
    width: 750px;
    height: auto;
    position: relative;
    display: block;
    overflow: hidden;
}
#flashHome {
    float: left;
    display: block;
    width:485px;
    height: 255px;
    margin-left: 15px;
    margin-top: 5px;
}


you should had a div with clear:both after the div flashHome -

<div id="flashHome">
......
</div>
<div style="clear:both"></div>


Give the Height as 100% like below:

container 
{
   width: 750px;
   height: 100%;
   margin-left: auto;
   margin-right: auto;
   position: relative;
   border:1px;
   border-color: #b7b7b7;
   border-style: solid;
}
contentHome 
{
   width: 750px;
   height: 100%;
   position: relative;
   display: block;
   overflow: hidden; 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消