Reputation: 1
I need to align my columns and rows to same height and same position. I managed it in desktop view but now I have problems in mobile view.
I attached 3 images, the first is the correct desktop view. Second is the mobile view and the third is the correct mobile view I want.
https://i.sstatic.net/7Skp8.jpg
<div class="container">
<div class="row align-items-start">
<div class="col-md">
<h2>Környezetvédelem</h2>
</div>
<div class="col-md">
<h2>Történetünk</h2>
</div>
<div class="col-md">
<h2>Kapcsolat</h2>
</div>
</div>
<div class="row align-items-center">
<div class="col-md ">
<img class="img-fluid indep-sub-image" src="img/indep-menu/kornyezetvedelem.jpg">
</div>
<div class="col-md">
<img class="img-fluid indep-sub-image" src="img/indep-menu/tortenetunk.jpg">
</div>
<div class="col-md">
<img class="img-fluid indep-sub-image" src="img/indep-menu/kapcsolat.jpg">
</div>
</div>
</div>
I want to keep the correct lines in desktop view, even when the title takes two line but at the same time I want the correct order in mobile view.
Upvotes: 0
Views: 1144
Reputation: 16
<div class="container">
<div class="row align-items-start">
<div class="col-md-4 col-sm-4">
<h2>Környezetvédelem</h2>
</div>
<div class="col-md-4 col-sm-4">
<h2>Történetünk</h2>
</div>
<div class="col-md-4 col-sm-4">
<h2>Kapcsolat</h2>
</div>
</div>
<div class="row align-items-center">
<div class="col-md-4 col-sm-4">
<img class="img-fluid indep-sub-image" src="img/indep-menu/kornyezetvedelem.jpg">
</div>
<div class="col-md-4 col-sm-4">
<img class="img-fluid indep-sub-image" src="img/indep-menu/tortenetunk.jpg">
</div>
<div class="col-md-4 col-sm-4">
<img class="img-fluid indep-sub-image" src="img/indep-menu/kapcsolat.jpg">
</div>
</div>
</div>
Upvotes: 0
Reputation: 670
Please try this solution.
<div class="container">
<div class="row">
<div class="col-md-4">
<h2>Környezetvédelem</h2>
<img class="img-fluid indep-sub-image" src="img/indep-menu/kornyezetvedelem.jpg">
</div>
<div class="col-md-4">
<h2>Történetünk</h2>
<img class="img-fluid indep-sub-image" src="img/indep-menu/tortenetunk.jpg">
</div>
<div class="col-md-4">
<h2>Kapcsolat</h2>
<img class="img-fluid indep-sub-image" src="img/indep-menu/kapcsolat.jpg">
</div>
</div>
</div>
Upvotes: 1
Reputation: 3859
Don't make two separate rows, instead use one row.Below your heading add the image that you want to display. Hope this works for you.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row align-items-start">
<div class="col-md-4">
<h2>Környezetvédelem</h2>
<img class="img-fluid indep-sub-image" src="img/indep-menu/kornyezetvedelem.jpg">
</div>
<div class="col-md-4">
<h2>Történetünk</h2>
<img class="img-fluid indep-sub-image" src="img/indep-menu/tortenetunk.jpg">
</div>
<div class="col-md-4">
<h2>Kapcsolat</h2>
<img class="img-fluid indep-sub-image" src="img/indep-menu/kapcsolat.jpg">
</div>
</div>
</div>
</body>
</html>
Upvotes: 1