I need to align my li images in center. I have tried style="text-align: center;" in ul component. but it did not work. Thanks in advance.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<ul style="text-align: center;">
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=1.jpg" title=" " ><i style="display: block;"></i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=1.jpg" alt=""> </div>
</li>
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=2.jpg" title=" " ><i style="display: block;"></i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=2.jpg" alt=""> </div>
</li>
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=3.jpg" title=" " ><i style="display: block;"> </i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=3.jpg" alt=""> </div>
</li>
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=4.jpg" title=" " ><i style="display: block;"></i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=4.jpg" alt=""> </div>
</li>
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=5.jpg" title=" " ><i style="display: block;"></i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=5.jpg" alt=""> </div>
</li>
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=6.jpg" title=" " ><i style="display: block;"></i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=6.jpg" alt=""> </div>
</li>
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=7.jpg" title=" " ><i style="display: block;"></i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=7s.jpg" alt=""> </div>
</li>
<li >
<div > <span > <span > <a rel="lightbox-demo" href="https://via.placeholder.com/50x50.png?text=8.jpg" title=" " ><i style="display: block;"></i></a> </span> </span> <img src="https://via.placeholder.com/50x50.png?text=8.jpg" alt=""> </div>
</li>
</ul>
CodePudding user response:
you can use flex-box o grid
ul {
display: grid;
place-items: center;
}
ul {
display: flex;
align-items: center;
justify-content: center;
}