0
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
font-family: arial;
}
#content {
width: 400px;
height: 400px;
background: green;
text-align: center;
line-height: 400px;
color: #ffffff;
}
#yes:checked #content {
display: block;
}
#no:checked #content{
display: none;
}
</style>
</head>
<body>
<p>Deseja visualizar o conteúdo?</p>
<label for="yes">Sim<input id="yes" name="option" type="radio"></label>
<label for="no">Não<input id="no" name="option" type="radio"></label>
<div id="content">
<h1>Conteúdo</h1>
</div>
</body>
</html>
In the above example it was for when I marked the radio button with id="yes"
it be displayed and when mark the radio button with id="no"
he disappear, but nothing happens, because?
And the JS is where my friend?
– Jakson Fischer
No! is only with CSS
– joão batista
A pseudo-class
:checked
is used when the element is marked and is what I am doing by marking an element for something to happen to it, but nothing happens the basis is that neither this example https://answall.com/questions/261970/show-hideapenas-com-css– joão batista
In this example you gave me, there’s an answer, it doesn’t help you?
– Jakson Fischer
No! already solved I left an answer with the solution, but thanks!
– joão batista
I saw, I left a +1 by the haha answer
– Jakson Fischer