我试图在网页上放置 2 个按钮,一个浮动到左侧,另一个浮动到右侧。两个命令按钮中都有多行样式的文本。下面是我最近的尝试。它似乎在 Firefox 中有效,但在 IE 8 中甚至没有关闭。有什么想法可以让它在两种环境中工作吗?谢谢。
CSS:
body {
background-color: green;
}
.idxQuestion {
font-size: 36;
text-align: center;
}
.idxButtons {
margin-top:60px;
margin-left: auto;
margin-right:auto;
width:350px;
}
.buttonchoice1,.buttonchoice2
{
text-align: center;
background:white;
padding: 5px;
}
.buttonchoice1 {
float:left;
border:5px solid red;
}
.buttonchoice2 {
float:right;
border:5px solid blue;
}
.spanchoice1 {
font-size: 30px;
}
.spanchoice2 {
font-size: 10px;
}
HTML:
<div class="idxQuestion">
<h1>Big Question?</h1>
</div>
<div class="idxButtons">
<h:button class="buttonchoice1" onclick="option1?faces-redirect=true" >
<h:outputText escape=false>
<span class="spanchoice1">No</span><br />
<span class="spanchoice2">additional info 1</span>
</h:outputText>
</h:button>
<h:button class="buttonchoice2" onclick="option2?faces-redirect=true" >
<h:outputText>
<span class="spanchoice1">Yes</span><br />
<span class="spanchoice2">additional info 2</span>
</h:outputText>
</h:button>
</div>
小提琴:http: //jsfiddle.net/MF23L/