I assumed, that unlike when using table it should be easy to align content in a div vertically:
Edit: I want to align the first and the last columns and keep the others like they are.
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div >
<div >align me vertically
</div>
<div >
<div >
<span >1</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >2</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
<div >
some text could be here
</div>
</div>
<div >
<div >
<span >3</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >4</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >5</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >6</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >7</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >8</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<line x1="15" y1="9" x2="9" y2="15"></line>
<line x1="9" y1="9" x2="15" y2="15"></line>
</svg>
</div>
</div>
How can I align the text and the svg vertically?
CodePudding user response:
Change your div with the align-middle to align-items-center.
CodePudding user response:
Here you go...
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' integrity='sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU' crossorigin='anonymous'>
<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js' integrity='sha384-skAcpIdS7UcVUC05LJ9Dxay8AXcDYfBJqt1CJ85S/CFujBsIzCIv l9liuYLaMQ/' crossorigin='anonymous'></script>
</head>
<body>
<div >
<div >align me vertically
</div>
<div >
<div >
<span >1</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >2</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
<div >
some text could be here
</div>
</div>
<div >
<div >
<span >3</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >4</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >5</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >6</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >7</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<div >
<span >8</span>
</div>
<div >
<img src="https://pngimg.com/uploads/futurama/futurama_PNG73.png" >
</div>
</div>
<div >
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<line x1="15" y1="9" x2="9" y2="15"></line>
<line x1="9" y1="9" x2="15" y2="15"></line>
</svg>
</div>
</div>
</body>
</html>
