Bootstrap 如何仅为内部图元添加边框网格线?

vmjh9lq9  于 2023-05-11  发布在  Bootstrap
关注(0)|答案(1)|浏览(117)

我有一个网格图像库。我想有灰色网格线边界之间的所有图像图片,只有内部的,而不是外部的线。我该怎么做呢?阅读所有文档,寻找网格线颜色属性。
有人知道CSS或HTML中的属性吗?我会有不同的图片配置。

.card {
    border-color: #D3D3D3;
    border-style: solid;
    border-width: 1px;
    width: 100%;
    margin-right: 0;
    padding: 0;
}

.card-header {
    background-color: white;
}

.card-body {
    background-color: white;
}


.cardcheckbox {
    position: absolute;
    right: 5px;
    top: 5px;
    /*vertical-align: middle;
    float: right;*/
    visibility: hidden;
}


input[type=checkbox]:checked {
    visibility: visible;
}

.card:hover .cardcheckbox {
    visibility: visible;
}


.material-icons {
    display: inline-flex;
    vertical-align: top;
}

.card-header .accordion-toggle {
    &.collapsed:after {
        font-family: 'Material Icons';
        content: "\e5cf";
    }

    &:after {
        font-family: 'Material Icons';
        content: "\e5ce";
        float: right;
        color: grey;
    }
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div class="card" style="width: 30.00rem">
   <div aria-multiselectable="true" class="accordian md-accordion" id="accordionEx" role="tablist">
      <div class="grid-container" id="gridid531937b3b9b54801ab80573cf91d0852" style="  display: grid;
         grid-template-columns: repeat(3, 1fr);
         grid-template-rows: repeat(1, 1fr);
         grid-gap: 0em;
         padding: 0px;
         align-items: stretch;
         position: relative; "><input class="cardcheckbox" id="checkid" type="checkbox"><img id="imgid531937b3b9b54801ab80573cf91d08520" src="https://www.woodlandtrust.org.uk/media/100078482/Sycamore01.jpg?cb=-11897985&amp;preset=gallery-tab-main-image" style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"><img id="imgid531937b3b9b54801ab80573cf91d08521" src="https://statesymbolsusa.org/sites/statesymbolsusa.org/files/styles/symbol_thumbnail__medium/public/primary-images/Applesfreshpicked.jpg?itok=YmYkBfY7" style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"><img id="imgid531937b3b9b54801ab80573cf91d08522" src="https://openbookphilly.com/wp-content/uploads/2016/11/bookstack.png" style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"></div>
      <div class="card-header" id="headingOne1" role="tab"><a aria-controls="id531937b3b9b54801ab80573cf91d0852" aria-expanded="true" class="accordion-toggle collapsed" data-parent="#accordionEx" data-toggle="collapse" href="#id531937b3b9b54801ab80573cf91d0852">Tree</a></div>
      <div aria-labelledby="headingOne1" class="collapse" data-parent="#accordionEx" id="id531937b3b9b54801ab80573cf91d0852" role="tabpanel">
         <div class="card-body">Tree with leaves</div>
      </div>
   </div>
</div>

au9on6nz

au9on6nz1#

您可以使用grid-template-columns来实现这一点。

  • 创建一个父容器来保存你的四个图像。
  • 设置一个背景颜色(希望的边框颜色)。
  • 将填充设置为0
  • 然后按grid-template-column排列图像:汽车

汽车;

  • 然后将gap添加到grid-gap:10 px;(以网格形式显示容器的背景颜色)。
  • 请参阅下面的代码以供参考 *
.container {
  width: 200px;
  display: grid;
  grid-template-columns: auto auto;
  grid-gap: 10px;

  background-color: #000;
  padding: 0;
}
.container > div {
  background-color: #ccc;
  padding: 20px;
  text-align: center;
}

超文本标记语言

<div class="container">
      <div>Image here</div>
      <div>Image Here</div>
      <div>Image here</div>
      <div>Image here</div>
    </div>

为了帮助你形象化,我创建了一个示例代码
http://plnkr.co/edit/gIeumXLt0k3FPVCgGlDd?p=preview
希望能帮上忙
干杯!

相关问题