【问题标题】:Background covered on hover悬停时覆盖的背景
【发布时间】:2020-01-14 20:59:55
【问题描述】:

我希望在鼠标悬停时覆盖背景,但我不知道如何让红色背景在将鼠标悬停在标题后面时覆盖它。我希望标题保持固定在圆圈上,并且鼠标悬停在标题后面完全是红色的,红色的图像透明度会稍微褪色。

    <div class="view view-first">
<h2>LOGOS</h2>
<div class="mask">
  <p>The Beginning Part Of The Branding Process.Logos I Have Done For Clients</p>
  <a href="#" class="info">Click Here</a>
</div>
</div>

这是 CSS 上的 CSS 我想让背景放在标题后面

.view {
  position: relative;
  margin: 10px 0px 10px 10px;
  display: block;
  float: left;
  border: 10px solid #909090;
  overflow: hidden;
  text-align: center;
  background-image: url("../images/over1.jpg");
  border-radius: 50%;
   -moz-box-shadow:    inset 0 0 10px #000000;
   -webkit-box-shadow: inset 0 0 10px #000000;
   box-shadow:         inset 0 0 10px #000000;
  max-width: 30.26%;
	height: 300px;
}

.view .mask,
.view .content {
  overflow: hidden;
  top: 0;
  left: 0
}

.view h2 {
  text-transform: uppercase;
  text-decoration: underline;
  border: 1px solid #000000;
  color: #FFFFFF;
  font-weight: 900;
  text-align: center;
  font-size: 30px;
  padding: 10px;
  background:#000000;
  margin: 50px 0 0 0;
  overflow: hidden;
}

.view p {
 position: relative;
 display: block;
  font-family: Merriweather, serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
  padding: 0px 10px 0px;
  text-align: center;
  text-shadow:
		-1px -1px 0 #000,
		1px -1px 0 #000,
		-1px 1px 0 #000,
		1px 1px 0 #000;

}

.view a.info {
  font-size: 26px;
  text-decoration: none;
  padding: 10px 10px;
  background: #000;
  color: #fff;
  font-family: Raleway, serif;
  text-transform: uppercase;
  box-shadow: 0 0 1px #000;
}

.view a.info:hover {
  box-shadow: 0 0 5px #000
}


/*1*/

.view-first img {
  /*1*/
  transition: all 0.2s linear;
}

.view-first .mask  {
 position: relative;
 display: block;
 opacity: 0;
 background-color: rgba(255,0,4,0.57);
 transition: all 0.4s ease-in-out;
 height: 100%; 
	
}

.view-first h2 {
  transform: translateY(1px);
  opacity: 100;
  transition: all 0.2s ease-in-out;
}

.view-first p {
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.2s linear;
}

.view-first a.info {
  opacity: 0;
  transition: all 0.2s ease-in-out;
}


/* */

.view-first:hover img {
  transform: scale(1.1);
}

.view-first:hover .mask {
	display: block;
  opacity: 1;
}

.view-first:hover h2,
.view-first:hover p,
.view-first:hover a.info {
  opacity: 1;
  transform: translateY(0px);
}

.view-first:hover p {
  transition-delay: 0.1s;
}

.view-first:hover a.info {
  transition-delay: 0.2s;
}
<div class="mask">
      <p>The Beginning Part Of The Branding Process.Logos I Have Done For Clients</p>
      <a href="#" class="info">Click Here</a>
    </div>

请告诉我如何解决此问题 Html regular mouseover

【问题讨论】:

    标签: html css hover mouseover cover


    【解决方案1】:

    .bg {
      background-size: cover;
      background-repeat: no-repeat;
      background-position: center center
    }
    
    .hoverable:hover{
      height: 100vh;
    }
    <div class="bg" style="background: url('https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg')">
    
    <div class="hoverable"> Hover Me </div>
    
    </div>

    【讨论】:

      猜你喜欢
      • 2015-10-11
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-14
      • 1970-01-01
      • 2020-06-21
      • 2017-10-20
      相关资源
      最近更新 更多