悬停效果不显示隐藏内容

时间:2021-04-20 10:16:38

标签: html css

Html Code

output- hover on name and the value displays beneath, atm its visible 。最佳 { font-family: 'Brush Script MT',草书; 字体大小:50px; }

  .hid{
    align-content: center;
    padding:auto 0;
    margin:0;
    display:none;
  } 

.top:hover .hid
{
  color: red;
  display: block;
}

我检查了其他类似的主题,尝试了 + 和 ~ 等组合符,但仍然不起作用。

请帮忙。 tia

1 个答案:

答案 0 :(得分:0)

  • 删除 +p 因为您隐藏了整个 .hid
  • 并删除 + 中的 .top:hover + .hid
  .top
  {
   font-family: 'Brush Script MT', cursive;
   font-size:50px;
  }
   
  .hid{
    display: float;
    align-content: center;
    padding:auto 0;
    margin:0;
    display:none;
  } 

.top:hover  .hid
{
  color: red;
  display: block;
}

你可以检查这个https://jsfiddle.net/a178x59n/