How to centre-align a title above few image? - html

my relative html code now is like this. I haven't add the title in the below code yet. Please help. Thank you.
<div class="body">
<div class="intro">
<h1>Main.</h1>
<h3>type something</h2>
<section class="buttonone">
<button>Sign up</button>
</section>
</div>
<section class="container">
<figure>
<div class="random"><img src="drink.jpg" alt=""></div>
<figcaption>lemonade</figcaption>
</figure>
<figure>
<div class="random"><img src="toro.jpg" alt=""></div>
<figcaption>omakasa-Toro sushi</figcaption>
</figure>
<figure>
<div class="random"><img src="noodle.jpg" alt=""></div>
<figcaption>ramei</figcaption>
</figure>
<figure>
<div class="random"><img src="oyster.jpg" alt=""></div>
<figcaption>oyster sushi</figcaption>
</figure>
</section>

use flexbox
img {
width: 10vw;
}
.container {
display: flex;
justify-content: space-around;
}
#title{
text-align:center;
border:solid 1px black;
}
figure{
border:solid 1px black;
padding:6px;
}
<div id='title'>my Title</div>
<section class="container">
<figure>
<div class="random"><img src="https://via.placeholder.com/150" alt=""></div>
<figcaption>lemon</figcaption>
</figure>
<figure>
<div class="random"><img src="https://via.placeholder.com/150" alt=""></div>
<figcaption>omaka</figcaption>
</figure>
<figure>
<div class="random"><img src="https://via.placeholder.com/150" alt=""></div>
<figcaption>ramei</figcaption>
</figure>
<figure>
<div class="random"><img src="https://via.placeholder.com/150" alt=""></div>
<figcaption>oysteri</figcaption>
</figure>
</section>

you just need to add flexbox to your CSS code! with justify-content
I also used css grid for centering vertically easily using the new place-items css property
.container {
/* make items one near the other in the X axis */
display: flex;
justify-content: space-around;
}
img {
/* if the image is a lot bigger, it will be resized and be responsive */
max-width: 100%;
}
/* centering vertically */
.container>figure,
.intro {
display: grid;
place-items: center;
}
<div class="body">
<div class="intro">
<h1>Main.</h1>
<h3>type something</h2>
<section class="buttonone">
<button>Sign up</button>
</section>
</div>
<section class="container">
<!-- 1 -->
<figure>
<div class="random">
<img src="https://picsum.photos/200" alt="">
</div>
<figcaption>lemonade</figcaption>
</figure>
<!-- 2 -->
<figure>
<div class="random">
<img src="https://picsum.photos/200" alt="">
</div>
<figcaption>omakasa-Toro sushi</figcaption>
</figure>
<!-- 3 -->
<figure>
<div class="random">
<img src="https://picsum.photos/200" alt="">
</div>
<figcaption>ramei</figcaption>
</figure>
<!-- 4 -->
<figure>
<div class="random">
<img src="https://picsum.photos/200" alt="">
</div>
<figcaption>oyster sushi</figcaption>
</figure>
</section>
</div>

Make a parent container class=container and make two child containers class=text centre for center aligned text and class=img grid for the image grid.
Now your parent container class will be having display: flex property with flex-grow or width property now for text you'll be putting text-align: center and for grid class you'll be using justify-content: space-between

Simply you have to add css h1 {text-align: center;}
.container{
display:flex;
}
h1{
text-align: center;
}
img{
max-width: 100%;
}
<div class="body">
<div class="intro">
<h1>Title</h1>
</div>
<section class="container">
<figure>
<div class="random">
<img src="https://i.picsum.photos/id/1076/201/201.jpg?hmac=w0KXxl0av8l5EHqgJfjULxPosXBvFTV86-fnAGgZbnY" alt="">
</div>
</figure>
<figure>
<div class="random">
<img src="https://i.picsum.photos/id/1076/201/201.jpg?hmac=w0KXxl0av8l5EHqgJfjULxPosXBvFTV86-fnAGgZbnY" alt="">
</div>
</figure>
<figure>
<div class="random">
<img src="https://i.picsum.photos/id/1076/201/201.jpg?hmac=w0KXxl0av8l5EHqgJfjULxPosXBvFTV86-fnAGgZbnY" alt="">
</div>
</figure>
<figure>
<div class="random">
<img src="https://i.picsum.photos/id/1076/201/201.jpg?hmac=w0KXxl0av8l5EHqgJfjULxPosXBvFTV86-fnAGgZbnY" alt="">
</div>
</figure>
</section>
</div>

Use display: flex; justify-content: center; and make sure you have a width of a 100% and those CSS properties will work almost everywhere.
<div class="body">
<div class="intro">
<h1>Main.</h1>
<h3>type something</h2>
<section class="buttonone">
<button>Sign up</button>
</section>
</div>
<h1 class="title">Title</h1>
<section class="container">
<figure>
<div class="random">
<img src="./pexels-till-daling-12461880.jpg" alt="">
</div>
<figcaption>lemonade</figcaption>
</figure>
<figure>
<div class="random">
<img src="./pexels-till-daling-12461880.jpg" alt="">
</div>
<figcaption>omakasa-Toro sushi</figcaption>
</figure>
<figure>
<div class="random">
<img src="./pexels-till-daling-12461880.jpg" alt="">
</div>
<figcaption>ramei</figcaption>
</figure>
<figure>
<div class="random">
<img src="./pexels-till-daling-12461880.jpg" alt="">
</div>
<figcaption>oyster sushi</figcaption>
</figure>
</section>
</div>
.title {
width: 100%;
display: flex;
justify-content: center;
}
.container {
display: flex;
justify-content: center;
}
img {
width: 10rem;
height: 10rem;
}

Related

Stuck with responsiveness in bootstrap 4.6

when i resize the browser my sections are mixing each other
one section has two rows and 12 images
then
new section starts
and it has only one header if i resize my chrome browser those things are mixing
but in inspect tools it is not mixing working very well
why is that
here is my code
.second-page {
height: 100vh;
}
.second-page img {
width: 230px;
height: 137px;
padding: 5px;
filter: grayscale(100%);
transition: .5s;
}
.second-page img:hover {
filter: grayscale(0%);
transform: scale(1.1);
transform: .3s;
}
/* second-page ends */
/* third-page starts */
.third-page {
height: 100vh;
}
<section class="second-page">
<h1 class="text-center my-5">Intended Projects</h1>
<div class="row">
<div class="col-md-12 my-5 text-center">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
</div>
</div>
<div class="row">
<div class="col-md-12 col-sm-6 my-5 text-center">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
<img src="https://cdnuploads.aa.com.tr/uploads/Contents/2020/05/30/thumbs_b_c_a4a6996640e91d4ff86a71f5d9d9f84b.jpg?v=225920" alt="">
</div>
</div>
</section>
<!-- second-page ends -->
<!-- third-page starts -->
<section class="third-page ">
<h1 class="text-center">Our Developers Team</h1>
</section>
Your issue is not clear, still i've made this section responsive!
Add link of image in href, replacing #.
The third section is merged in second! it has to be inside a .
<section class="second-page">
<h1 class="text-center my-5">Intended Projects</h1>
<div class="row">
<div class="col-md-12 my-5 text-center">
<img src="#" alt="">
<img src="#" alt="">
<img src="#" alt="">
<img src="#" alt="">
<img src="#" alt="">
</div>
</div>
<div class="row">
<div class="col-md-12 my-5 text-center">
<img src="#" alt="">
<img src="#" alt="">
<img src="#" alt="">
<img src="#" alt="">
<img src="#" alt="">
</div>
</div>
<div>
<h1 class="text-center">Our Developers Team</h1>
</div>
</section>

Center Text on multiple images

I need to add centre text on multiple images of different sizes within their own tags in a container div.
This is how my HTML and CSS is setup
<section>
<div class="row ">
<div class="col ">
<div class="container gallery">
<img class="sports" src="img/block1Sports.jpg">
<h3 class="text1" >Sports</h3>
<img id="wellness" src="img/block2Wellness.jpg">
<h3 class="text1" >wellness</h3>
<img id="expeditions" src="img/block3Expeditions.jpg">
<h3 class="text1" >expeditions</h3>
<img id="games" src="img/block4Games.jpg">
<h3 class="text1" >games</h3>
<img id="culture" src="img/block5Culture.jpg">
<h3 class="text1" >culture</h3>
<img id="beauty" src="img/block6Beauty.jpg">
<h3 class="text1" >beauty</h3>
<img id="travelling" src="img/block7Travelling.jpg">
<h3 class="text1" >travelling</h3>
</div>
</div>
</div>
</section>
All these images have a single text messages which should all be centred, appreciate your help.
Here is a snap example of desired output
Instead of <img>, put your image in a div container using css background-image:url('');. Then use display:flex; (https://css-tricks.com/snippets/css/a-guide-to-flexbox/) on this div to position your text vertically and horizontally centered.
HTML
<section>
<div class="row ">
<div class="col ">
<div class="container gallery">
<div class="imageWithCenteredText sports">
<h3 class="text1" >Sports</h3>
</div>
</div>
</div>
...
</div>
</section>
CSS
.imageWithCenteredText {
display:flex;
justify-content: center;
align-items: center;
}
.sports {
background-image: url('img/block1Sports.jpg');
width: 500px; /* PICTURE WIDTH */
height: 500px; /* PICTURE HEIGHT */
}
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<style>
.gallery-item {
position: relative;
}
.gallery-item img {
width: 100%;
}
.gallery-item h3 {
position: absolute;
top: 50%;
left: 50%;
}
</style>
</head>
<body>
<section>
<div class="row ">
<div class="col ">
<div class="container gallery">
<div class="gallery-item">
<img class="sports" src="img/block1Sports.jpg">
<h3 class="text1" >Sports</h3>
</div>
<div class="gallery-item">
<img id="wellness" src="img/block2Wellness.jpg">
<h3 class="text1" >wellness</h3>
</div>
<div class="gallery-item">
<img id="expeditions" src="img/block3Expeditions.jpg">
<h3 class="text1" >expeditions</h3>
</div>
<div class="gallery-item">
<img id="games" src="img/block4Games.jpg">
<h3 class="text1" >games</h3>
</div>
<div class="gallery-item">
<img id="culture" src="img/block5Culture.jpg">
<h3 class="text1" >culture</h3>
</div>
<div class="gallery-item">
<img id="beauty" src="img/block6Beauty.jpg">
<h3 class="text1" >beauty</h3>
</div>
<div class="gallery-item">
<img id="travelling" src="img/block7Travelling.jpg">
<h3 class="text1" >travelling</h3>
</div>
</div>
</div>
</div>
</section>
</body>
</html>

center image inside a container

In this article I have three images that I want to be placed in the same line. The first image should go to the left, the second should be centered and the third will be placed to the right.
I have no problems with the first one and with the third one since doing a float:left or float:right in CSS I solve it but I can not get the second image to center.
<section>
<article>
<img class="first" src="img/1.jpg" alt="img"/>
<img class="second" src="img/2.jpg" alt="img"/>
<img class="third" src="img/3.jpg" alt="img"/>
</article>
</section>
I appreciate any help.
article {
display:flex;
justify-content:space-between;
}
<section>
<article>
<img class="first" src="https://picsum.photos/300/200" alt="img"/>
<img class="second" src="https://picsum.photos/300/200" alt="img"/>
<img class="third" src="https://picsum.photos/300/200" alt="img"/>
</article>
</section>
You can used flexbox.
article {
display:flex;
justify-content: space-between;
}
<section>
<article>
<img class="first" src="https://via.placeholder.com/150" alt="img"/>
<img class="second" src="https://via.placeholder.com/150" alt="img"/>
<img class="third" src="https://via.placeholder.com/150" alt="img"/>
</article>
</section>
I recommend you to use Flexbox.
<div class='flexWrapper'>
<img class="first" src="img/1.jpg" alt="img"/>
<img class="second" src="img/2.jpg" alt="img"/>
<img class="third" src="img/3.jpg" alt="img"/>
</div>
.flexWrapper {
display:flex;
flex-direction: row;
justify-content: space-between;
align-items: center; /* to align them vertically */
}
hello there!
<section>
<article>
<img class="first" src="img/1.jpg" alt="img"/>
<img class="second center" src="img/2.jpg" alt="img"/>
<img class="third" src="img/3.jpg" alt="img"/>
</article>
</section>
use this css class
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
now try to execute it.
finally I solved it by indicating text-align: center in css of the article. It works because the images, like the text, are line elements.
Thank you

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>

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!