I am facing an issue with aligning elements inside a div both vertically and horizontally. I have tried various CSS methods like margin auto, but none seem to work. If you could provide a solution and explain how it works, it would be greatly appreciated. Thank you.
<div id="tiritaContainer">
<div class="tirita">
<div class="tiritas"><img id="tirita1" src="assets/pictures/Front house.jpg" alt=""/></div>
<div class="tiritas"><img id="tirita2" src="assets/pictures/28.jpg" alt=""/></div>
<div class="tiritas"><img id="tirita3" src="assets/pictures/27.jpg" alt=""/></div>
</div>
<img class="next" src="assets/pictures/arrow-right.png" alt=""/>
</div>
* {
margin: 0px;
padding: 0px;
}
nav {
position: absolute;
left: 0px;
width: 100%;
background-color: #3333ff;
height: 40px;
text-align: center;
}
nav ul {
margin: 0;
padding: 0;
display: inline-block;
}
.nav li {
text-align: center;
list-style-type: none;
float: left;
width: 150px;
}
.nav li a {
text-decoration: none;
text-align: center;
font-size: 150%;
color: yellow;
line-height: 40px;
display: block;
}
.nav li a:hover {
background-color: chartreuse;
color: black;
}
#logo {
width: 20%;
border-radius: 35%;
margin-top: auto;
margin-bottom: auto;
}
#mainImg {
height: 65vh;
width: 50vw;
border: 3px solid black;
margin-left: auto;
margin-right: auto;
}
.tirita {
margin: 0 auto;
height: 105px;
width: 400px;
}
#gallery img {
display: none;
}
.tiritas img {
height: 100px;
width: 100px;
border: 3px solid blue;
float: left;
}
.tiritas:hover {
cursor: pointer;
border-color: red;
transform: scale(1.5);
}
center {
padding: 2%;
}
.prev, .next {
vertical-align: middle;
}
.prev {
float: left;
margin: 0 auto;
}
.next {
float: right;
}
#tiritaContainer {
display: inline-block;
margin-left: auto;
margin-right: auto;
margin-top: auto;
margin-bottom: auto;
}
I am trying to align the left and right arrow in the same row at the center both vertically and horizontally.