0
我有一個菜單,我必須用按鈕來覆蓋所有的div高度。我真的需要按鈕,因爲它的功能(我可以禁用它從CSS或JS例如)。所以,假設你有一個可調整大小的菜單(嘗試調整窗口大小in the fiddle),它可以有不同的高度值。如何用按鈕覆蓋div的所有高度?
<div id="header-menu">
<div id="header-back-button" onclick="alert('click')">
<button id="back-button">Back</button>
</div>
<div id="header-title">
<h1>This is my so so so long title</h1>
</div>
<div id="header-next-button">
<button id="next-button">
<img id = "imgMenu" src="https://cdn4.iconfinder.com/data/icons/wirecons-free-vector-icons/32/menu-alt-512.png"></img>
</button>
</div>
這裏是CSS:
#header-menu{
display: table;
width:100%
}
#header-back-button {
display: table-cell;
width: 15%;
min-width: 30px;
height: 25px;
background: orange;
}
#header-title {
display: table-cell;
width: 70%;
min-width: 40px;
background: yellow;
}
#header-next-button {
display: table-cell;
width: 15%;
min-width: 30px;
height: 25px;
background: orange;
}
button {
background: red;
border: 0px;
height:100%;
width:100%;
}
#imgMenu{
width: 100%;
height: 100%;
}
你能HEL我嗎?
但高度不能是固定的(不25px的;),因爲它的變化。嘗試調整你的「結果窗口」小提琴的寬度和高度...你會看到一些weard行爲 – gal007 2014-08-28 20:47:52
抱歉,我在代碼中犯了一個錯誤,因爲我在Inspector中完成了它,所以現在它是正確的代碼。但是,有一個最小寬度的按鈕不會再採取高度。那是因爲你的h1元素,你需要改變你的html,以使這個列增長 – Devin 2014-08-28 21:08:34