分频器没有显示onhover效果

时间:2018-03-07 01:06:27

标签: html css css3 divider onhover

我只是想尝试一个简单的修复。出于某种原因,我的分频器没有出现在悬停状态?我怎样才能让它像其他文本一样显示出来?我有另一个例子,我如何让分隔符在其他页面上查看...

http://runningfish.net/finestc/about/

位于页面标题下方的“关于”

此外,我目前正在使用的是runningfish.net/finestc 您可以在“最近销售”部分下方看到实时代码。

我仍然是一个初出茅庐的编码员,所以如果我做的事情效率低下或者你做得更好,请指出来!我希望在编码方面做得更好。批评欢迎!

谢谢!

.grids {
  width: 33.33%;
  float: left;
  display: inline-block;
  position: relative;
}

.grids img {
  display: block;
  height: 33.33vh;
  width: 100%;
}

.grid-image-description {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  visibility: hidden;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity .5s, visibility .5s;
}

.grid-image-description h2 {
  font-family: playfairdisplay;
  font-size: 1.7em;
  color: #fff;
}

.grid-image-description p {
  font-family: playfairdisplay;
  font-size: 1.0em;
  color: #fff;
}

.grid-image-description hr {
  border-top: 1px;
  border-color: #001532;
  border-style: solid;
  box-shadow: 2px 1px 15px #fff;
  margin: 0 0 0 10px;
  max-width: 200px;
}

.grids:hover .grid-image-description {
  visibility: visible;
  opacity: 1;
}

.grids-description {
  transition: .5s;
  transform: translateY(1em);
}

.grids:hover .grid-image-description {
  transform: translateY(0);
}
<a href="#nogo">
  <div class="grids">
    <img class="grid-image-cover" alt="" src="//runningfish.net/finestc/wp-content/uploads/2018/02/Depositphotos_11636543_original.jpg" />
    <div class="grid-image-description">
      <h2 class="grids-header">House For Sale</h2>
      <hr>
      <p class="grids-description">123 mulbury street</br>san diego, ca 92101
      </p>
    </div>
  </div>
</a>

1 个答案:

答案 0 :(得分:1)

width值添加到<hr>

.grids {
  width: 33.33%;
  float: left;
  display: inline-block;
  position: relative;
}

.grids img {
  display: block;
  height: 33.33vh;
  width: 100%;
}

.grid-image-description {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  visibility: hidden;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity .5s, visibility .5s;
}

.grid-image-description h2 {
  font-family: playfairdisplay;
  font-size: 1.7em;
  color: #fff;
}

.grid-image-description p {
  font-family: playfairdisplay;
  font-size: 1.0em;
  color: #fff;
}

.grid-image-description hr {
  border-top: 1px;
  border-color: #001532;
  border-style: solid;
  box-shadow: 2px 1px 15px #fff;
  margin: 0 0 0 10px;
  max-width: 200px;
  /* added */
  width: 200px;
}

.grids:hover .grid-image-description {
  visibility: visible;
  opacity: 1;
}

.grids-description {
  transition: .5s;
  transform: translateY(1em);
}

.grids:hover .grid-image-description {
  transform: translateY(0);
}
<a href="#nogo">
  <div class="grids">
    <img class="grid-image-cover" alt="" src="//runningfish.net/finestc/wp-content/uploads/2018/02/Depositphotos_11636543_original.jpg" />
    <div class="grid-image-description">
      <h2 class="grids-header">House For Sale</h2>
      <hr>
      <p class="grids-description">123 mulbury street<br>san diego, ca 92101
      </p>
    </div>
  </div>
</a>