如何对齐浣熊图片,使其出现在大圆形图片的右下方?就像在图像上一样。

我尝试了background-position:右下;以及位置:绝对;但这不起作用。

请参见下面的代码。

谢谢。

html - 如何将图片与另一张图片的底部对齐?-LMLPHP



.p-i--1 {
  background-image: url(http://www.zerohedge.com/sites/default/files/pictures/picture-3930.jpg);
}
.p-i {
  border-radius: 50%;
  background-position: bottom right;
  width: 40px;
  height: 40px;
  position: absolute;
}
.p-1 {
  float: left;
  width: 220px;
  height: 100%;
  position: relative;
}
.p-wrap {
  bottom: 0;
  width: 100%;
  text-align: center;
}
.pic-wrap {
  width: 122px;
  height: 122px;
  margin: 0 auto;
}
.p_pic-1 {
  background-image: url(http://www.fernomortuary.com/~/media/products-mortuary/swatches/Swatch_Burgundy.ashx?w=122);
  background-position: center;
  float: left;
  width: 122px;
  height: 122px;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
}
.p-description {
  font-family: Roboto;
  font-weight: 300;
  color: #666;
  font-size: 14px;
  text-align: center;
  float: left;
  margin-top: 0;
}
.p-name {
  text-align: center;
}

<div class="p-1">
  <div class="p-i--1 p-i"></div>
  <div class="pic-wrap">
    <a class="p_pic-1" href="index.html"></a>
  </div>
  <div class="p_wrap">
    <h4 class="p-name">Some text</h4>
    <p class="p-description">Some very very very very long description</p>
  </div>
</div>

最佳答案

将较小的图片放在.pic-wrap中。给它一个absolute位置,并使用bottomright属性将其对齐:

JS Fiddle

CSS所做的更改:

.pic-wrap {
  position: relative;
}
.p-i {
    position: absolute;
    bottom: 0;
    right: 0;
}


如果要在小图像周围使用白色边框:

.p-i {
   border: 3px solid white;
}


JS Fiddle

07-24 19:03
查看更多