button { width: 100px; height: 30px; background-color: grey; }
p {
display: none;
border: 1px solid black;
color: black;
width: 400px;
height: 100px;
padding: 10px;
text-align: center;
}
button:hover p {
display: block;
}
<button>
Click Me!
</button>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi sint obcaecati
eligendi eos officia ut itaque deserunt repellat deleniti similique quis
pariatu doloremque rem beatae accusamus, commodi esse eaque magnam.
</p>
after hovering on button paragraph is not getting displayed
2
Answers
In this case you can use
button:hover+p
Instead of using
use
as p and button are sibling elements.