问题描述
我正在寻找以下解决方案: If Radio Button is Selected Show Div
但没有javascript或jquery(仅使用html / css)?
谢谢
解决方法
您可以为广播输入添加焦点并为div添加样式
这是一个例子
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.div{
display: none;
}
.radio:focus + .div{
display: block;
}
</style>
</head>
<body>
<input type="radio" class="radio">
<div class="div">
<h3>hello world</h3>
</div>
</body>
</html>