在javascript中加载本地XML

时间:2012-01-07 17:37:11

标签: html css

简单的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>

谢谢。

1 个答案:

答案 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>

小提琴:http://jsfiddle.net/QPYML/