I want several text links that when they are hovered over a text is displayed below in a DIV.
For example if text called Ice cream is hovered upon with mouse then below in DIV a text is displayed about Ice cream. Another text near the Ice cream is Bananas, and if it is however the same DIV instead displays text about Bananas. I need to be able to make several of those. And the link text and the DIV with result text has to be on different areas of the page, meaning they shouldn’t need to be placed on same DIV.
Something close to this:
.hide {
display: none;
border: solid #ff8900 2px;
border-radius: 20px;
padding: 20px;
}
.outro:hover .hide {
display: block;
color: #474747;
}
<div class="outro">
<div id="info-logo">
<img src="https://picsum.photos/24/20" width="24" height="20">
</div>
<p>Know more</p>
<div class="hide">
<p>This is the big text block I am trying to copy</p>
</div>
</div>
Only this has link and resulting DIV all inside, they should be separate, and need to be able to have several links with several preset texts that show up on hover.
Preferably all in CSS without JS. Thanks.
Code I find is nested, need separate, with many options of preset text.
2
Answers
I am not sure if this can be done with CSS but you can easily do it with js:
You can add this in a script tag embedded into the html page or as a seperate file you can link. make sure to change the ID’s to the actual ids
Without nesting the link and the DIV:
and the CSS:
Now whenever you hover on the icecream or banana Text, a separate div containing your given text about icecream or banana appears.