<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="radio-toolbar">
<label for="mylabel-1"><input type="radio" id="mybutton-1" checked>All</label>
<label for="mylabel-2"><input type="radio" id="mybutton-2" >Open</label>
<label for="mylabel-2"><input type="radio" id="mybutton-3" >Archived</label>
</div>
</body>
</html>
我想添加css样式来输入标签内的单选按钮,我不想将css添加到外部标签** **有可能吗?
答案 0 :(得分:3)
以下是一个例子:
label input[type=radio]{
display:none;
}
此外,你需要使用它(使用相同的名称单选按钮只选择一个。否则,它看起来像复选框)
<label for="mylabel-1"><input name="rd" type="radio" id="mybutton-1" checked>All</label>
<label for="mylabel-2"><input name="rd" type="radio" id="mybutton-2" >Open</label>
<label for="mylabel-2"><input name="rd" type="radio" id="mybutton-3" >Archived</label>