首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在选择一个选项后使单选按钮显示为选中状态(CSS)

如何在选择一个选项后使单选按钮显示为选中状态(CSS)
EN

Stack Overflow用户
提问于 2016-04-09 19:05:21
回答 1查看 92关注 0票数 1

当我将鼠标悬停在选项的文本上并选择它时,单选按钮应该会被选中。这样,当我选择标签时,复选框将显示为选中状态。

我应该添加标签还是将td设置为按钮?

代码语言:javascript
复制
.zui-table {
    border: solid 1px #DDEEEE;
    border-collapse: collapse;
    border-spacing: 0;
    font: normal 13px Arial, sans-serif;
}
.zui-table thead th {
    background-color: #DDEFEF;
    border: solid 1px #DDEEEE;
    color: #336B6B;
    padding: 10px;
    text-align: left;
    text-shadow: 1px 1px 1px #fff;
}
.zui-table tbody td {
    border: solid 1px #DDEEEE;
    color: #333;
    padding: 10px;
    text-shadow: 1px 1px 1px #fff;
}
.zui-table-rounded {
    border: none;
}
.zui-table-rounded thead th {
    background-color: #CFAD70;
    border: none;
    text-shadow: 1px 1px 1px #ccc;
    color: #333;
    float: center;
}
.zui-table-rounded thead th:first-child {
    border-radius: 10px 0 0 0;
}
.zui-table-rounded thead th:last-child {
    border-radius: 0 10px 0 0;
}
.zui-table-rounded tbody td {
    border: none;
    border-top: solid 1px #957030;
    background-color: #EED592;
}
.zui-table-rounded tbody tr:last-child td:first-child {
    border-radius: 0 0 0 10px;
	
}
.zui-table-rounded tbody tr:last-child td:last-child {
    border-radius: 0 0 10px 0;
}
代码语言:javascript
复制
<table class="zui-table zui-table-rounded" align="center">
    <thead>
        <tr>
            <th colspan="4">1.Look at this series: 7, 10, 8, 11, 9, 12, ... What number should come next?</th>
            
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><input type="radio" name="question1" value="lr0101">7</td>
            <td><input type="radio" name="question1" value="lr0102">10</td>
            <td><input type="radio" name="question1" value="lr0103">12</td>
            <td><input type="radio" name="question1" value="lr0104">13</td>
            <!--Option b-->
        </tr>
       
    </tbody>
  </table>

EN

回答 1

Stack Overflow用户

发布于 2016-04-09 19:15:39

使用标签-我假设您实际上并不想在悬停文本时选择?

像这样

代码语言:javascript
复制
<td><label><input type="radio" 
name="question1" value="lr0101">7</label>/td>

或者像这样

代码语言:javascript
复制
<td><input type="radio" id="answer1" 
name="question1" value="lr0101"><label 
for="answer1">7</label>/td>`
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36515927

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档