html - 按钮元素中的多行样式文本

标签 html css internet-explorer firefox button

我想在网页上放置 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>   

fiddle :http://jsfiddle.net/MF23L/

最佳答案

用这段代码替换你的代码:

<div class="idxButtons">
    <button class="buttonchoice1" onclick="option1?faces-redirect=true">
        <outputText escape=false>
           <span class="spanchoice1">No</span><br />  
           <span class="spanchoice2">additional info 1</span> 
        </outputText>
     </button>
    <button class="buttonchoice2" onclick="option2?faces-redirect=true">
        <outputText>
           <span class="spanchoice1">Yes</span><br />  
           <span class="spanchoice2">additional info 2</span> 
        </outputText>
     </button>
</div>

关于html - 按钮元素中的多行样式文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12678399/

相关文章:

css - 如何在单击时来回旋转 SVG?

css - 如何让 td 表格单元格跨越表格的整个宽度?

html - 在 CSS 中切出另一个形状的形状 - 跨浏览器兼容性

javascript - HTML - 搜索不起作用

javascript - SVG 未在 Firefox 34.0.5 和 IE 11 中呈现

javascript - 无法使用appendChild在JavaScript中追加子项

html - 边距如何适用于带背景元素内部带背景的 div?

html - 我如何确定我的 DOCTYPE 和元数据正在推送哪种浏览器和文档模式?

html - tbody 的 CSS 表格加载叠加层

javascript - jqGrid 的 jQuery 问题