I am currently working on a website and trying to display an image preview alongside a block of text using Bootstrap 4. However, I am facing an issue where the columns wrap around the screen, resulting in a row that appears two columns tall.
Despite my attempts at modifying the classes of the div elements (specifically for centering), I have not been able to resolve this issue.
html,
body {
overflow-x: hidden;
}
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
.constrain-img {
max-width: 100%;
height: auto;
object-fit: contain;
}
.container-notfull {
padding: 15px;
width: 100%;
}
.img-center {
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 0;
margin-bottom: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<body>
<br><br><br>
<img class="d-block w-100 background-cover" src="http://placehold.it/700x500">
<div class="container-notfull">
<div class="row">
<div class="col-md-12 text-center">
<h2>
Summer Camps 2019
</h2>
<br>
<h3>Curriculum</h3>
<p>
In this camp... text
</p>
<br>
</div>
</div>
<div class="row align-items-center">
<div class="col-md-6 align-self-center constrain-img">
<img class="h-75 img-center" src="http://placehold.it/700x700">
</div>
<div class="col-md-6 text-center align-self-center">
<h3>
There will be an entertaining camp... text
</h3>
<h4><a href="/css/img/flyer.pdf" download>Here</a> is a download to the flyer</h4>
<br>
<h3>Details</h3>
<p><b>Place:</b></p>
<p><b>Time:</b></p>
<p><b>Days:</b></p>
<p><b>Price:</b></p>
<p>Maximum of 10 people per day</p>
<br>
<h4>Register now</h4>
</div>
</div>
</div>
</body>
Although the total column widths equal 12, leading me to expect them to fit horizontally, they are instead overflowing and wrapping around to the bottom of the row.