html - 加号周围的元素

标签 html css

我无法像屏幕截图中那样实现此 block 。问题的本质,在加号的中心及其图片或 block 周围,所有这些都应该在所有屏幕上都能正常工作。如果您能帮助实现,我将不胜感激。

.center-block{
    position: relative;
    width: 100%;
    &:before{
      position: absolute;
      content: '';
      width: 128px;
      height: 1px;
      background: #86b4d0;
      top: 180px;
      left: 100px;
      transform: rotate(90deg);
    }
    &:after{
      position: absolute;
      content: '';
      width: 128px;
      height: 1px;
      background: #86b4d0;
      top: 160px;
      left: 100px;
    }
    &__items{
      margin-bottom: 20px;
      &:last-child{
        margin-bottom: 0;
      }
      a:not(:last-child){
        margin-right: 40px;
      }
    }
  }
<div class="center-block">
<div class="center-block__items">
<a href="#">
  <img src="https://via.placeholder.com/150C/" alt=""></a>
<a href="#"><img src="https://via.placeholder.com/150C/" alt=""></a>
</div>
<div class="center-block__items">
  <a href="#">
    <img src="https://via.placeholder.com/150C/" alt=""></a>
  <a href="#">
<img src="https://via.placeholder.com/150C/" alt="">
  </a>
</div>
</div>

结果:

enter image description here

最佳答案

HTML

<div class="center-block">
<div class="center-block__items">
    <a href="#">
      <img src="https://via.placeholder.com/150C/" alt=""></a>
    <a href="#" style="margin-left: -17px;"><img src="https://via.placeholder.com/150C/" alt=""></a>
</div>
<div class="center-block__items">
      <a href="#">
        <img src="https://via.placeholder.com/150C/" alt=""></a>
      <a href="#" style="margin-left: -17px;">
    <img src="https://via.placeholder.com/150C/" alt="">
      </a>
    </div>
    </div>

CSS

    .center-block{
    position: relative;
    width: 100%;
    &:before{
      position: absolute;
      content: '';
      width: 128px;
      height: 1px;
      background: #86b4d0;
      top: 180px;
      left: 100px;
      transform: rotate(90deg);
    }
    &:after{
      position: absolute;
      content: '';
      width: 128px;
      height: 1px;
      background: #86b4d0;
      top: 160px;
      left: 100px;
    }
    &__items{
      margin-bottom: 20px;
      &:last-child{
        margin-bottom: 0;
      }
      a:not(:last-child){
        margin-right: 40px;
      }
    }
  }

关于html - 加号周围的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58063047/

相关文章:

javascript - 选择其他按钮时,JQuery Mobile 单选按钮保持选中状态。使用 .html 函数

javascript - 如何防止仅针对网站图标的 HTTP 请求?

javascript - onmousedown 事件对象行为异常

javascript - 展开折叠问题

带有背景图片 url 的 CSS 变量

html - 将 CSS 选择器限制为最近的父级

php - 意外的 T_CONSTANT_ENCAPSED_STRING

html - 如何在 SVG 中绘制垂直线

css - box-shadow 在 Chrome 中不起作用

html - 如何左对齐菜单中的文本并使文本保持可见?