Html 如何使用3个图像列进行悬停?

Html 如何使用3个图像列进行悬停?,html,css,multiple-columns,mouseover,Html,Css,Multiple Columns,Mouseover,我是一个非常初学编码的人。我想在不使用JS的情况下,鼠标悬停在图像上时显示文本。然而,我已经为HTML和CSS制作了3个图像列,不知道如何在代码中添加悬停效果。我尝试了很多不同的方法,但都失败了。我想我的代码搞乱了,肯定出了什么问题。请告诉我如何解决这个问题 我想在我的3张图片上做这样的效果,但是在一个专栏里 以下是我的HTML代码: <div class="row"> <div class="column"> <img src="https://i.

我是一个非常初学编码的人。我想在不使用JS的情况下,鼠标悬停在图像上时显示文本。然而,我已经为HTML和CSS制作了3个图像列,不知道如何在代码中添加悬停效果。我尝试了很多不同的方法,但都失败了。我想我的代码搞乱了,肯定出了什么问题。请告诉我如何解决这个问题

我想在我的3张图片上做这样的效果,但是在一个专栏里

以下是我的HTML代码:

<div class="row">
  <div class="column">
    <img src="https://i.imgur.com/LBFnJzd.gif" style="width:100%" class="hover">
  </div>

  <div class="column">
    <img src="https://i.imgur.com/eOrPIjL.png" style="width:100%" class="hover">
  </div>

  <div class="column">
    <img src="https://i.imgur.com/HWi1rPW.png" style="width:100%">
  </div>
</div>
HTML

检查小提琴

第二效应

HTML

JS小提琴

.栏目{ 宽度:70%; 身高:100%; 位置:相对位置; 溢出:隐藏; } .column>img{ 宽度:100%; 浮动:左; 高度:300px; } .悬停{ 宽度:100%; 高度:300px; 背景:rgba0,0,0,0; 颜色:RGBA255255,0; 位置:绝对位置; 顶部:0;左侧:0; 过渡:所有。5s轻松; } .onHover:悬停{ 背景:rgba0,0,0,6; 颜色:RGBA255255,1; 过渡:所有。5s轻松; } 一些文本
header {
  text-align: center;
  animation: myanimation 15s infinite;
}

@keyframes myanimation {
  0% {
    background-color: #20B2AA;
  }
  25% {
    background-color: #FF8C00;
  }
  50% {
    background-color: #6495ED;
  }
  75% {
    background-color: #F08080;
  }
  100% {
    background-color: #20B2AA;
  }
}

a {
  color: white;
}

a:hover,
a:visited,
a:link,
a:active {
  text-decoration: none;
}

h1 {
  margin-top: 10;
  color: #231900;
  font-family: 'Sunflower', sans-serif;
  font-size: 80px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 84px;
  margin-bottom: 70px;
  text-transform: uppercase;
}

h2 {
  color: #cccccc;
  font-family: 'Sunflower', sans-serif;
  font-size: 25px;
  font-weight: 300;
  line-height: 32px;
  margin: 0px 0px 50px;
  text-align: center;
}

ul {
  list-style-type: none;
  margin: 0;
  padding: 5px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.2);
  position: -webkit-sticky;
  /* Safari */
  position: sticky;
  top: 0;
}

li {
  float: center;
  display: inline;
  padding: 0px 30px 0px 10px;
  color: #333333;
  font-family: 'Sunflower', sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 20px;
  text-align: center;
  position: -webkit-sticky;
  /* Safari */
  position: sticky;
  top: 0;
}


.responsive {
  width: 100%;
  max-width: 400px;
  height: auto;
}

* {
  box-sizing: border-box;
}

.row {
  display: -ms-flexbox;
  /* IE10 */
  display: flex;
  -ms-flex-wrap: wrap;
  /* IE10 */
  flex-wrap: wrap;
  padding: 0 30px;
}

/* Create four equal columns that sits next to each other */

.column {
  -ms-flex: 25%;
  /* IE10 */
  flex: 25%;
  max-width: 33%;
  padding: 0 4px;
}

.column img {
  margin-top: 8px;
  vertical-align: middle;
}

p {
  color: #231900;
  font-family: 'Crimson Text';
  font-size: 34px;
  font-weight: 500;
  line-height: 48px;
  margin-bottom: 48px;
  max-width: 650px;
}

/* Responsive layout - makes a two column-layout instead of four columns */

@media screen and (max-width: 800px) {
  .column {
    -ms-flex: 50%;
    flex: 50%;
    max-width: 50%;
  }
}

/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */

@media only screen and (max-width: 700px) {
  .responsive {
    width: 49.99999%;
    margin: 6px 0;
  }
}

@media screen and (max-width: 600px) {
  .column {
    -ms-flex: 100%;
    flex: 100%;
    max-width: 100%;
  }
}

@media only screen and (max-width: 500px) {

  h1 {
    font-size: 30px;
    padding: 10px;
    margin-bottom: 0px;
  }
  h2 {
    font-size: 15px;
  }
  li {
    padding: 3px;
  }

  .responsive {
    width: 100%;
  }
}
<div class="row">
  <div class="column">
    <img src="https://i.imgur.com/LBFnJzd.gif" style="width:100%" class="image">
    <div class="overlay">
    <div class="text">Hello World</div>
  </div>
  </div>

  <div class="column">
    <img src="https://i.imgur.com/eOrPIjL.png" style="width:100%" class="image">
    <div class="overlay">
    <div class="text">Hello World</div>
  </div>
  </div>

  <div class="column">
    <img src="https://i.imgur.com/HWi1rPW.png" class="image" style="width:100%">
    <div class="overlay">
    <div class="text">Hello World</div>
  </div>
  </div>
</div>
.column {
  position: relative;
}

.image {
  display: block;
  width: 100%;
  height: auto;
}
.overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  opacity: 0;
  transition: .5s ease;
  background-color: #008CBA;
}

.column:hover .overlay {
  opacity: 1;
}

.text {
  color: white;
  font-size: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  text-align: center;
}
<div class="row">
  <div class="column">
    <img src="https://i.imgur.com/LBFnJzd.gif" style="width:100%" class="image">
    <div class="middle">
    <div class="text">John Doe</div>
  </div>
  </div>

  <div class="column">
    <img src="https://i.imgur.com/eOrPIjL.png" style="width:100%" class="image">
    <div class="middle">
      <div class="text">John Doe</div>
    </div>
  </div>

  <div class="column">
    <img src="https://i.imgur.com/HWi1rPW.png" class="image" style="width:100%">
    <div class="middle">
      <div class="text">John Doe</div>
    </div>
  </div>
</div>
.column {
    position: relative;
}

.image {
  opacity: 1;
  display: block;
  width: 100%;
  height: auto;
  transition: .5s ease;
  backface-visibility: hidden;
}

.middle {
  transition: .5s ease;
  opacity: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  text-align: center;
}

.column:hover .image {
  opacity: 0.3;
}

.column:hover .middle {
  opacity: 1;
}

.text {
  background-color: #4CAF50;
  color: white;
  font-size: 16px;
  padding: 16px 32px;
}