Reputation: 769
I have a Grid Image Gallery. I would like to have grey grid line borders Between all the image pictures, only the inner ones, and Not the outer lines. How would I do conduct this? Reading through all the documentation, seeking a gridline color property.
Does anyone know the property in CSS or HTML? I will have different configurations of pictures.
.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&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>
Upvotes: 0
Views: 1788
Reputation: 76
You may use grid-template-columns to do the trick.
create a parent container that will hold your four images.
set a background color (desire color of the border).
set the padding to 0
then do the trick arrange the images by grid-template-column: auto
auto;
then add gap to them grid-gap: 10px; (to show the background color of the container as grid).
please see code below for reference
.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;
}
html
<div class="container">
<div>Image here</div>
<div>Image Here</div>
<div>Image here</div>
<div>Image here</div>
</div>
to help you visualize i create a sample code
http://plnkr.co/edit/gIeumXLt0k3FPVCgGlDd?p=preview
Hope it helps
Cheers!
Upvotes: 3