【发布时间】:2023-03-12 06:39:01
【问题描述】:
我在这个问题上碰了壁,我正在一个网站上工作,我需要隐藏一个包含额外内容的 DIV,直到用户将鼠标悬停在一个图标上,但我不知道如何做到这一点。我尝试了各种不同的方法(>、+ 和 ~),但我就是无法让它工作。
HTML
.fa-canapes-icon:hover .canapes-popup{
display:block;
}
<div class="canapes">
<p>Canapes <i class="fa fa-info-circle fa-canapes-icon"></i></p>
<div class="canapes-popup">
<h1>Example Canape Menu</h1>
<p>This is a popular selection. We do of course have other options we are happy to discuss with you.<br>
Mini Yorkshires with Medium Roast Beef and Horseradish<br>
Satay Chicken Skewers with a Peanut Sauce<br>
Spicy Prawn with Mango<br>
Smoked Salmon & Mascarpone crostini with Dill & Lemon<br>
Mozzerella Pearls with Sun-blush tomatoes & Fresh Basil (V)<br>
Honey and Sesame Coated Cocktail Sausages</p>
</div>
</div>
该页面可以查看here,它是“婚礼套餐 3”,我尝试将其添加到带有小食 i 图标的位置。
任何帮助将不胜感激。
【问题讨论】:
-
您要隐藏/显示的 div 是哪个?是不是这个:
canapes-popup