2011-05-23 86 views
2

內的div高度CSS

我想要的客戶端內容將是80%
我希望它是這樣

Example http://img545.imageshack.us/img545/2822/exmapler.png

有100%的高度和它的工作有很大的容器

這裏是我的網頁HTML和CSS

CSS

* 
{ 
    padding: 0; 
    margin: 0; 
} 
html, body 
{ 
    height: 100%; 
} 

#container 
{ 
    min-height: 99%; 
    border-color: #36A9E9; 
    border-width: thin; 
    border-style: solid; 
    width: 85%; 
    margin: 0 auto; 
    background-color: ThreeDFace; 
} 
* html #container 
{ 
    height: 100%; 
} 
#ClientContent 
{ 
    min-height: 80%; 
    border-color: #36A9E9; 
    border-width: thin; 
    border-style: solid; 
    width: 100%; 
    margin: 0 auto; 
    background-color: ThreeDFace; 
} 

HTML

<body> 

<form id="container" runat="server"> 

<div id="ClientContent"> 

</div> 
</form> 
</body> 

請提出任何想法?

+1

更加清晰,請 – breezy 2011-05-23 13:20:20

+0

添加圖像更清晰 – avnic 2011-05-23 13:26:38

回答

3

這似乎是工作here

* 
{ 
    padding: 0; 
    margin: 0; 
} 
html, body 
{ 
    height: 100%; 
} 
#container 
{ 
    position: relative; 
    min-height: 99%; 
    border-color: #36A9E9; 
    border-width: thin; 
    border-style: solid; 
    width: 85%; 
    margin: 0 auto; 
    background-color: ThreeDFace; 
} 
* html #container 
{ 
    height: 100%; 
} 
#ClientContent 
{ 
    position: absolute; 
    height: 80%; 
    border-color: #36A9E9; 
    border-width: thin; 
    border-style: solid; 
    width: 99.6%; 
    margin: 0 auto; 
    background-color: ThreeDFace; 
} 
+0

非常感謝!!!! – avnic 2011-05-23 13:46:36

0

添加#Clientcontent {height:80%}

+0

不工作,就可以在代碼中看到上述 – avnic 2011-05-23 13:32:32

+0

是什麼瀏覽器,你有這個問題用? – breezy 2011-05-23 13:35:48

+0

在chrome上試過,也就是7 – avnic 2011-05-23 13:36:53

0

你只需把垂直對齊到頂部,它應該沒問題。把它放在#ClientContent上。我不確定這是否真的缺失。嘗試添加最大高度:80%。就像這樣:

#ClientContent 
{ 
max-height:80%; 
vertical-align:top; 
min-height: 80%; 
border-color: #36A9E9; 
border-width: thin; 
border-style: solid; 
width: 100%; 
margin: 0 auto; 
background-color: ThreeDFace; 
} 
+0

喜試過這個......仍然沒有工作.. :( – avnic 2011-05-23 13:36:32

+0

你clientContent元素是什麼呢?它是一個div?跨度?的p? – Joze 2011-05-23 13:42:00