How could I achieve design like showin in attach image using grid - html

Here is the code of the gridbox, I have currently.
.service-box-container{
display: grid;
grid-template-columns: repeat(3, 2fr);
gap: 15px;
}
.service-box-container img{
max-width: 100%;
width: 100%;
object-fit: cover;
object-position: center;
height: 460px;
border-radius: 20px;
}
<div class="service-box-container">
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
<div class="service-box">
<figure>
<img src="https://via.placeholder.com/350" class="" alt="">
</figure>
</div>
</div>
Design I am looking to acheive:
I want to show only two items on every even row and 3 items on every odd row using grid css. This should be applicable to any additional rows as well.
Currently it is showing same style on both odd and even row. Here, is the https://jsfiddle.net/fk9y0uhd/3

Use grid-row-start and grid-row-end properties same like for column as well grid-col-start and grid-col-end to make this layout. this will help you out
https://www.youtube.com/watch?v=xBSlwwitD5U&t=867s check. OR use 3 column grid for odd one and 6 column grid for evens.

Related

How can you align multiple figures vertically with bootstrap?

I have used the following code to align multiple images vertically in bootstrap:
<div class="container border rounded overflow">
<div class="row text-center p-2 flex-nowrap" id="anID">
<img src="../../static/img1.jpg" width=15% alt="">
<img src="../../static/mg2.jpg" width=15% alt="">
...
</div>
</div>
This is the result:
Multiple pictures next to each other in a rounded container:
I want to achieve the same thing but with figures. Using the same code doesn't work. It just makes them appear on top of each other, Like this:
<div class="container border rounded">
<div class="row text-center pt-2 px-2" id="anotherID">
<figure>
<img src="../../static/img2.jpg" width=15% alt="">
<figcaption>a caption</figcaption>
</figure>
<figure>
<img src="../../static/img3.jpg" width=15% alt="">
<figcaption>another caption</figcaption>
</figure>
...
</div>
</div>
Can anyone help me fix this?
Bootstrap has class d-flex that sets child elements next to each other. In other words it make element with class name d-flex a flex container and it's direct child to flex-items.
.d-flex{
display:flex;
}
It has display:flex property in general.
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.min.js"></script>
<div class="container border rounded">
<div class="d-flex flex-wrap text-center pt-2 px-2" id="anotherID">
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" width="30%" class="img-fluid" alt="">
<figcaption>a caption</figcaption>
</figure>
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" width="30%" class="img-fluid" class="img-fluid" alt="">
<figcaption>another caption</figcaption>
</figure>
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" width="30%" class="img-fluid" alt="">
<figcaption>another caption</figcaption>
</figure>
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" width="30%" class="img-fluid" alt="">
<figcaption>another caption</figcaption>
</figure>
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" width="30%" alt="">
<figcaption>another caption</figcaption>
</figure>
</div>
</div>
<h1>Just for your reference I am showing below part how bootstrap works</h1>
<div class="container border rounded">
<div class="row">
<div class="col-sm-3">
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" class="img-fluid" alt="">
<figcaption>a caption</figcaption>
</figure>
</div>
<div class="col-sm-3">
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" class="img-fluid" alt="">
<figcaption>a caption</figcaption>
</figure>
</div>
<div class="col-sm-3">
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" class="img-fluid" alt="">
<figcaption>a caption</figcaption>
</figure>
</div>
<div class="col-sm-3">
<figure>
<img src="https://i.stack.imgur.com/r2NFZ.png" class="img-fluid" alt="">
<figcaption>a caption</figcaption>
</figure>
</div>
</div>
</div>
Please try it with bootstrap
<div class="container border rounded overflow">
<div class="row text-center pt-2 px-2 align-item-center justify-content-start overflow-auto flex-nowrap" id="anotherID">
<figure width=15%>
<img src="https://dummyimage.com/200x200/000000/E4E4E4" alt="">
<figcaption>a caption</figcaption>
</figure>
<figure width=15%>
<img src="https://dummyimage.com/200x200/000000/E4E4E4" alt="">
<figcaption>a caption</figcaption>
</figure>
<figure width=15%>
<img src="https://dummyimage.com/200x200/000000/E4E4E4" alt="">
<figcaption>a caption</figcaption>
</figure>
<figure width=15%>
<img src="https://dummyimage.com/200x200/000000/E4E4E4" alt="">
<figcaption>a caption</figcaption>
</figure>
<figure width=15%>
<img src="https://dummyimage.com/200x200/000000/E4E4E4" alt="">
<figcaption>a caption</figcaption>
</figure>
<figure width=15%>
<img src="https://dummyimage.com/200x200/000000/E4E4E4" alt="">
<figcaption>a caption</figcaption>
</figure>
<figure width=15%>
<img src="https://dummyimage.com/200x200/000000/E4E4E4" alt="">
<figcaption>a caption</figcaption>
</figure>
</div>
</div>

How can I add header text to img alt in HTML/Bootstrap

I have the below code in Bootstrap that display an image:
<div class="work">
<img class="anim" src="1.png" alt="Text1">
<img class="anim" src="2.jpeg" alt="Text2">
<img class="anim" src="3.jpeg" alt="Text3">
<img class="anim" src="4.jpeg" alt="Text4">
</div>
The result looks like this:
How can I add some heading/title to each picture in order to describe the purpose of each one?
Try this code with Bootstrap grid system and using h3 to insert title of image
<div class="row">
<div class="col-sm-6">
<h3>Text</h3>
<img class="anim" src="1.png" alt="Text1">
</div>
<div class="col-sm-6">
<h3>Text</h3>`
<img class="anim" src="2.png" alt="Text1">
</div>
<div class="col-sm-6">
<h3>Text</h3>
<img class="anim" src="3.png" alt="Text1">
</div>
<div class="col-sm-6">
<h3>Text</h3>
<img class="anim" src="4.png" alt="Text1">
</div>
</div>
You can use the figure element for this which Bootstrap has styling for, e.g
<div class="work">
<figure class="figure">
<figcaption class="figure-caption">Image 1</figcaption>
<img class="anim figure-img" src="1.png" alt="Text1">
</figure>
<figure class="figure">
<figcaption class="figure-caption">Image 2</figcaption>
<img class="anim figure-img" src="2.png" alt="Text2">
</figure>
<figure class="figure">
<figcaption class="figure-caption">Image 3</figcaption>
<img class="anim figure-img" src="3.png" alt="Text3">
</figure>
<figure class="figure">
<figcaption class="figure-caption">Image 4</figcaption>
<img class="anim figure-img" src="4.png" alt="Text4">
</figure>
</div>

i want to show products like different gird. i think i don't know what my question but i am showing product like this image

i want to show products like different gird. i think i don't know what my question but i am showing product like this image:
i tried to bootstrap but no response.
my code is :
<div class="col-md-2 column productbox">
<img src="http://placehold.it/460x250/e67e22/ffffff&text=HTML5" class="img-responsive">
<div class="producttitle">Product 2</div>
<div class="productprice">
<div class="pull-right">BUY</div>
<div class="pricetext">£8.95</div>
</div>
</div>
<div class="col-md-2 column productbox">
<img src="http://placehold.it/460x250/e67e22/ffffff&text=HTML5" class="img-responsive">
<div class="producttitle">Product 2</div>
<div class="productprice">
<div class="pull-right">BUY</div>
<div class="pricetext">£8.95</div>
</div>
</div>
<div class="col-md-2 column productbox">
<img src="http://placehold.it/460x250/e67e22/ffffff&text=HTML5" class="img-responsive">
<div class="producttitle">Product 3</div>
<div class="productprice">
<div class="pull-right">BUY</div>
<div class="pricetext">£8.95</div>
</div>
</div>
<div class="col-md-2 column productbox">
<img src="http://placehold.it/460x250/e67e22/ffffff&text=HTML5" class="img-responsive">
<div class="producttitle">Product 4</div>
<div class="productprice">
<div class="pull-right">BUY</div>
<div class="pricetext"> £8.95</div>
</div>
</div>
anybody can help me?
thanks
You can achieve this using CSS3 Flexbox property. Here
is the link.
* {box-sizing: border-box}
body {margin: 0}
.row {
display: flex;
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.column {
flex: 25%;
max-width: 25%;
padding: 0 4px;
}
.column img {
display: block;
width: 100%;
margin-top: 8px;
}
/* Responsive layout - makes a two column-layout instead of four columns */
#media (max-width: 800px) {
.column {
flex: 50%;
max-width: 50%;
}
}
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
#media (max-width: 600px) {
.column {
flex: 100%;
max-width: 100%;
}
}
<div class="row">
<div class="column">
<img src="https://www.w3schools.com/w3images/wedding.jpg" alt="">
<img src="https://www.w3schools.com/w3images/rocks.jpg" alt="">
<img src="https://www.w3schools.com/w3images/falls2.jpg" alt="">
<img src="https://www.w3schools.com/w3images/paris.jpg" alt="">
<img src="https://www.w3schools.com/w3images/nature.jpg" alt="">
<img src="https://www.w3schools.com/w3images/mist.jpg" alt="">
<img src="https://www.w3schools.com/w3images/paris.jpg" alt="">
</div>
<div class="column">
<img src="https://www.w3schools.com/w3images/underwater.jpg" alt="">
<img src="https://www.w3schools.com/w3images/ocean.jpg" alt="">
<img src="https://www.w3schools.com/w3images/wedding.jpg" alt="">
<img src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="">
<img src="https://www.w3schools.com/w3images/rocks.jpg" alt="">
<img src="https://www.w3schools.com/w3images/underwater.jpg" alt="">
</div>
<div class="column">
<img src="https://www.w3schools.com/w3images/wedding.jpg" alt="">
<img src="https://www.w3schools.com/w3images/rocks.jpg" alt="">
<img src="https://www.w3schools.com/w3images/falls2.jpg" alt="">
<img src="https://www.w3schools.com/w3images/paris.jpg" alt="">
<img src="https://www.w3schools.com/w3images/nature.jpg" alt="">
<img src="https://www.w3schools.com/w3images/mist.jpg" alt="">
<img src="https://www.w3schools.com/w3images/paris.jpg" alt="">
</div>
<div class="column">
<img src="https://www.w3schools.com/w3images/underwater.jpg" alt="">
<img src="https://www.w3schools.com/w3images/ocean.jpg" alt="">
<img src="https://www.w3schools.com/w3images/wedding.jpg" alt="">
<img src="https://www.w3schools.com/w3images/mountainskies.jpg" alt="">
<img src="https://www.w3schools.com/w3images/rocks.jpg" alt="">
<img src="https://www.w3schools.com/w3images/underwater.jpg" alt="">
</div>
</div>

Space out divs automatically in wrapper based on quantity

I have a Bootstrap website that has a div wrapper and then 1 - 6 possible divs in side. These are 200px wide and need to be spaced equally inside.
<div class="container">
<div class="row">
<div class="wasps_home_footer_blocks_container">
<div class="wasps_home_footer_block col-md-2 ">
<figure> <img src="test.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block col-md-2 ">
<figure> <img src="test.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block col-md-2 ">
<figure> <img src="test.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block col-md-2 ">
<figure> <img src="test.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
</div>
</div>
CSS:
.wasps_home_footer_blocks_container {
width: 100%;
margin: auto;
margin-top: auto;
margin-top: 20px;
}
.wasps_home_footer_block {
width: 200px;
text-align: center;
}
This shows the four divs but left aligned in the .wasps_home_footer_blocks_container div.
The wasps_home_footer_block divs need to be in the middle of the containing div equally spaced apart. (See attached image)
Better to use Flexbox instead of Bootstrap Grid, in this case.
You can remove the commented code to see additional blocks added.
.wasps_home_footer_blocks_container {
display: flex;
width: 100%;
margin: auto;
margin-top: auto;
justify-content: center;
}
.wasps_home_footer_block {
width: 200px;
margin: 20px;
text-align: center;
max-height: 100px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="wasps_home_footer_blocks_container">
<div class="wasps_home_footer_block">
<figure>
<img src="http://www.martialartsmoviejunkie.com/wp-content/uploads/2014/08/Drunken-Master.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block">
<figure>
<img src="https://s3.drafthouse.com/images/made/drunken-master-1_758_426_81_s_c1.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block">
<figure>
<img src="http://blackbeltmag.com/wp-content/uploads/DrunkenMasterII1.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<!--UNCOMMENT ME-->
<!-- <div class="wasps_home_footer_block">
<figure> <img src="http://blackbeltmag.com/wp-content/uploads/DrunkenMasterII1.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
<div class="wasps_home_footer_block">
<figure> <img src="http://blackbeltmag.com/wp-content/uploads/DrunkenMasterII1.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div> -->
<div class="wasps_home_footer_block">
<figure>
<img src="http://media1.break.com/dnet/media/450/925/2925450/7-martial-arts-movies-you-need-to-see-image-7.jpg" alt="" class="img-responsive">
<figcaption>
<h4>Test link</h4>
</figcaption>
</figure>
</div>
</div>
</div>

HTML / CSS How do I force images to horizontally display

I have some code below that displays 6 images. I want to display all 3 images under imagegroup0 horizontally next to each other and then all images of imagegroup1 horizontally as well, but under the images of imagegroup0. The code posted below works unless the image is large enough so that not all 3 images are visible without scrolling. When the images get too large, my browser displays them vertically. My questions are:
1.How do I force the images of an image group to display horizontally even if it requires horizontal scrolling?
2.Is there a way to do that without having to declare the image groups to display explicitly? Basically, I want to say, under a place horizontally. (All images will be same size so alignment does not matter).
#imagegroup0 div {
display: inline-block;
}
#imagegroup1 div {
display: inline-block;
}
<div id="imagegroup0">
<div id="image0.0">
<figure>
<img src="example.jpg" />
<figcaption>image</figcaption>
</figure>
</div>
<div id="image0.1">
<figure>
<img src="example.jpg" />
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image0.2">
<figure>
<img src="example.jpg" />
<figcaption>image3</figcaption>
</figure>
</div>
</div>
<div id="imagegroup1">
<div id="image1.0">
<figure>
<img src="example.jpg" />
<figcaption>image</figcaption>
</figure>
</div>
<div id="image1.1">
<figure>
<img src="example.jpg" />
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image1.2">
<figure>
<img src="example.jpg" />
<figcaption>image3</figcaption>
</figure>
</div>
</div>
Update: Here's what I ended up doing based on feedback below:
<html>
<head>
<title>images</title>
<style>
.group {
white-space: nowrap;
}
.group div {
display: inline-block;
}
</style>
</head>
<body>
<div class="group">
<div>
<figure>
<img src="example.jpg"/>
<figcaption>image</figcaption>
</figure>
</div>
<div>
<figure>
<img src="example.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
<div>
<figure>
<img src="example.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</div>
<div class="group">
<div>
<figure>
<img src="example.jpg"/>
<figcaption>image</figcaption>
</figure>
</div>
<div>
<figure>
<img src="example.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
<div>
<figure>
<img src="example.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</div>
</body>
</html>
Use white-space: nowrap and use classes to avoid writing out every class.
nowrap means all elements will stay on same line even if there is no more space for them and they would normally break on closest still in-box white-space
.group {
white-space: nowrap;
}
.group div {
width: 50px;
height: 50px;
display: inline-block;
border: 1px solid white;
background-color: red;
}
<div class="group" id="imagegroup0">
<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
</div>
<div class="group" id="imagegroup1">
<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
</div>
#imagegroup0, #imagegroup1{
display: flex;
text-align: center;
overflow: auto;
}
<div id="imagegroup0">
<div id="image0.0">
<figure>
<img src="example.jpg"/>
<figcaption>image</figcaption>
</figure>
</div>
<div id="image0.1">
<figure>
<img src="example.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image0.2">
<figure>
<img src="example.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</div>
<div id="imagegroup1">
<div id="image1.0">
<figure>
<img src="example.jpg"/>
<figcaption>image</figcaption>
</figure>
</div>
<div id="image1.1">
<figure>
<img src="example.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image1.2">
<figure>
<img src="example.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</div>
You can give width: 30%; for each div.
#imagegroup0 div {
display: inline-block;
width: 30%;
}
#imagegroup1 div {
display: inline-block;
width: 30%;
}
<div id="imagegroup0">
<div id="image0.0">
<figure>
<img src="example.jpg" />
<figcaption>image</figcaption>
</figure>
</div>
<div id="image0.1">
<figure>
<img src="example.jpg" />
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image0.2">
<figure>
<img src="example.jpg" />
<figcaption>image3</figcaption>
</figure>
</div>
</div>
<div id="imagegroup1">
<div id="image1.0">
<figure>
<img src="example.jpg" />
<figcaption>image</figcaption>
</figure>
</div>
<div id="image1.1">
<figure>
<img src="example.jpg" />
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image1.2">
<figure>
<img src="example.jpg" />
<figcaption>image3</figcaption>
</figure>
</div>
</div>
One of the Posible solution is to use "Bootstrap framework"
<html>
<head>
<title>images</title>
<style>
#imagegroup0 div
{
display:inline-block;
}
#imagegroup1 div
{
display:inline-block;
}
img
{
width:133px;
height:133px;
}
</style>
</head>
<body>
<div id="imagegroup0">
<div id="image0.0">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image</figcaption>
</figure>
</div>
<div id="image0.1">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image0.2">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</div>
<div id="imagegroup1">
<div id="image1.0">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image</figcaption>
</figure>
</div>
<div id="image1.1">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
<div id="image1.2">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</div>
</body>
</html>
Answers to your questions:
1.How do I force the images of an image group to display horizontally even if it requires horizontal scrolling?
- You can use bootstrap and use class "table" which is fully responsive and it automatically displays images horizontally manner.
2.Is there a way to do that without having to declare the image groups to display explicitly?
- Yes, as i said in answer of Q-1 you can use bootstrap "table"
<html>
<head>
<title>images</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<style>
#imagegroup0 div
{
display:inline-block;
}
#imagegroup1 div
{
display:inline-block;
}
img
{
width:333px;
height:333px;
}
</style>
</head>
<body>
<div class="table-responsive">
<table class="table">
<tr>
<td>
<div id="image0.0">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image1</figcaption>
</figure>
</div>
</td>
<td>
<div id="image0.1">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
</td>
<td>
<div id="image0.2">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</td>
</tr>
<tr>
<td>
<div id="image0.0">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image1</figcaption>
</figure>
</div>
</td>
<td>
<div id="image0.1">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image2</figcaption>
</figure>
</div>
</td>
<td>
<div id="image0.2">
<figure>
<img src="https://cdn.pixabay.com/photo/2014/10/16/20/04/eye-491625_960_720.jpg"/>
<figcaption>image3</figcaption>
</figure>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
Answers to your questions:
1.How do I force the images of an image group to display horizontally even if it requires horizontal scrolling?
You can use bootstrap and use class "table" and "table-responsive" which is fully responsive and it automatically displays images horizontally manner and gives you a scroll whenever require.
2.Is there a way to do that without having to declare the image groups to display explicitly?
Yes, as I said in answer to Q-1 you can use bootstrap "table"
Thank you!