简单的html高度问题,我基本上只想将3个按钮的高度设置为身高的25%,对于width属性工作正常,但不是因为某种原因而不是
div.mainMenuButton { }
谢谢。height:25%;
text-align:center;
width:100%;
background:green;
<body>
<div id="menuContainer">
<div id = "playButton" class = "mainMenuButton" onClick="loadGame()">
Play
</button>
</div>
<div id = "optionsButton" class = "mainMenuButton">
Options
</div>
<div id = "aboutButton" class = "mainMenuButton">
About
</div>
</div>
</body>
答案 0 :(得分:0)
这是CSS:
<强> CSS 强>
.mainMenuButton {
height:25%;
text-align:center;
width:100%;
background:green;
}
#menuContainer {
height: 100%;
}
html,body {
margin:0;
padding:0;
height:100%;
}
HTML:
<强> HTML 强>
<div id="menuContainer">
<div id = "playButton" class = "mainMenuButton" onClick="loadGame()">
Play
</div>
<div id = "optionsButton" class = "mainMenuButton">
Options
</div>
<div id = "aboutButton" class = "mainMenuButton">
About
</div>
</div>