孩子的保证金问题

时间:2018-06-30 01:35:23

标签: html css animation

这个问题有点复杂。我试图按this fiddle中的顺序放置一些图像,但是我必须为图像添加一个父div,以便它们可以与动画框一起正常工作,该动画框显示图像所代表的人物的姓名。问题在于div没有像单独的img标签那样排列图像的方式。任何帮助,将不胜感激。

body {
	background: #7d7d7d;
}

h2 {
  font-family: Pacifico;
  font-size: 10px;
  font-style: normal;
  font-variant: normal;
  font-weight: 200;
  color: white;
  line-height: 0px;
}

#friends {
  position: absolute;
  width: 200px;
  height: 20px;
  top: 50px;
  right: 200px;
  padding-top: 4px;
  border: 1px solid white;
	z-index: -10;
	background-color: #000;
  font-family: arial;
  text-align: center;
  overflow: hidden;
  -webkit-transition: all 0.5s ease-out;
  -moz-transition: all 0.5s ease-out;
  -o-transition: all 0.5s ease-out;
  transition: all 0.5s ease-out;
}

#friends:hover {
  height: 240px;
  border-radius: 10px;
}

.peeps {
  position: relative;
	margin-top: 5px;
  margin-right: 5px;
  width: 50px;
  height: 50px;
}

.sam, .ys, .kani, .ash, .adam, .lit, .tsun, .lara, .bath {
  width: 50px;
  height: 50px;
  border: 1px solid black;
  border-radius: 100%;
  -webkit-transition: all 0.8s ease-out;
  -moz-transition: all 0.8s ease-out;
  transition: all 0.8s ease-out;
}

.sam:hover {
  border-radius: 0;
  box-shadow: 0px 0 15px #a2dfe0;
}

#name {
  position: absolute;
  margin-top: -20px;
  height: 20px;
  width: 0px;
  opacity: 0;
	vertical-align: middle;
	line-height: 15px;
  background-color: #000;
  border: 1px solid white;
  overflow: hidden;
  z-index: -1;
  left: 50%;
  transform: translate(-50%, 0);
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  transition: all 1s ease;
}

.peeps:hover #name {
  margin-top: -85px;
  height: 20px;
  width: 50px;
  opacity: 1;
  background-color: #000;
  color: #000;
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  transition: all 1s ease;
}
<html>
  <div id="friends">
    <br><br><!-- jsfiddle doesn't like my text -->
    <div class="peeps">
      <img class="sam" src="http://usd.chatango.com/profileimg/s/a/samantha/thumb.jpg" />
      <p id="name" style="text-align: center;">
        <font color="white" size="1">Ugh</font>
      </p>
    </div>
    <div class="peeps">
      <img class="ys" src="http://usd.chatango.com/profileimg/y/s/ys/thumb.jpg">
      <p id="name" style="text-align: center;">
        <font color="white" size="1">Ugh</font>
      </p>
    </div>
    <div class="peeps">
      <img class="kani" src="http://usd.chatango.com/profileimg/k/a/kaninkiller/thumb.jpg">
      <p id="name" style="text-align: center;">
        <font color="white" size="1">Ugh</font>
      </p>
    </div>
  </div>
</html>

1 个答案:

答案 0 :(得分:0)

如果我正确理解了您的问题,只需将.peeps类设置为display:inline-block;。这是一个片段。

body {
	background: #7d7d7d;
}

h2 {
  font-family: Pacifico;
  font-size: 10px;
  font-style: normal;
  font-variant: normal;
  font-weight: 200;
  color: white;
  line-height: 0px;
}

#friends {
  position: absolute;
  width: 200px;
  height: 20px;
  top: 50px;
  right: 200px;
  padding-top: 4px;
  border: 1px solid white;
	z-index: -10;
	background-color: #000;
  font-family: arial;
  text-align: center;
  overflow: hidden;
  -webkit-transition: all 0.5s ease-out;
  -moz-transition: all 0.5s ease-out;
  -o-transition: all 0.5s ease-out;
  transition: all 0.5s ease-out;
}

#friends:hover {
  height: 240px;
  border-radius: 10px;
}

.peeps {
  position: relative;
	margin-top: 5px;
  margin-right: 5px;
  width: 50px;
  height: 50px;
  display:inline-block;
}

.sam, .ys, .kani, .ash, .adam, .lit, .tsun, .lara, .bath {
  width: 50px;
  height: 50px;
  border: 1px solid black;
  border-radius: 100%;
  -webkit-transition: all 0.8s ease-out;
  -moz-transition: all 0.8s ease-out;
  transition: all 0.8s ease-out;
}

.sam:hover {
  border-radius: 0;
  box-shadow: 0px 0 15px #a2dfe0;
}

#name {
  position: absolute;
  margin-top: -20px;
  height: 20px;
  width: 0px;
  opacity: 0;
	vertical-align: middle;
	line-height: 15px;
  background-color: #000;
  border: 1px solid white;
  overflow: hidden;
  z-index: -1;
  left: 50%;
  transform: translate(-50%, 0);
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  transition: all 1s ease;
}

.peeps:hover #name {
  margin-top: -85px;
  height: 20px;
  width: 50px;
  opacity: 1;
  background-color: #000;
  color: #000;
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  transition: all 1s ease;
}
    <div id="friends">
      <br><br> <!-- jsfiddle doesn't like my text -->

      <img class="sam" src="http://usd.chatango.com/profileimg/s/a/samantha/thumb.jpg">

      <img class="ys" src="http://usd.chatango.com/profileimg/y/s/ys/thumb.jpg">

      <img class="kani" src="http://usd.chatango.com/profileimg/k/a/kaninkiller/thumb.jpg">

      <img class="ash" src="http://usd.chatango.com/profileimg/m/u/multiplelovearrows/thumb.jpg">

      <img class="adam" src="http://usd.chatango.com/profileimg/t/i/tiefier/thumb.jpg">

      <img class="lit" src="http://usd.chatango.com/profileimg/l/i/littered/thumb.jpg">

      <img class="tsun" src="http://usd.chatango.com/profileimg/n/i/nicholle/thumb.jpg">

      <img class="lara" src="http://usd.chatango.com/profileimg/h/o/hopefulhero/thumb.jpg">

			<img class="bath" src="http://usd.chatango.com/profileimg/m/a/maytimes/thumb.jpg">
    </div>