如何用CSS3實現單選框的選定取消及切換
<input ?type="radio" checked="checked">
<a href="#">頁面1</a>
<input ?type="radio">
<a href="#">頁面2</a>
選中input實現使input 下的a鏈接到相應頁面
<input ?type="radio" checked="checked">
<a href="#">頁面1</a>
<input ?type="radio">
<a href="#">頁面2</a>
選中input實現使input 下的a鏈接到相應頁面
2016-09-08
舉報
2022-03-25
可以嵌套?只要不交叉隨便用2個border也應該是2px吧,就是margin-left:790px。看了您的回答我才知道border也是計算在寬度內的。
2016-09-09
input,a{
?? ?position:fixed;
?? ?width:100px;
?? ?height:50px;
?? ?line-height:50px;
}
input{
?? ?opacity:0;
?? ?z-index:100;
}
a{
?? ?background-color:blue;
?? ?font-size:16px;
?? ?color:#fff;
?? ?font-weight:bold;
?? ?text-decoration:none;
?? ?text-align:center;
?? ?z-index:10;
}
.a2,.a2+a{
?? ?left:100px;
}
input:checked+a{
?? ?background-color:red;
}
</style>
</head>
<body>
<input? type="radio" name="radio-set" checked="checked" class="a1">
<a href="#">頁面1</a>
<input? type="radio" name="radio-set" class="a2">
<a href="#">頁面2</a>