When you properly incorporate Bootstrap CSS and JS, the col-6
class will function just like col-xs-6
.
I noticed that you have not included Bootstrap@4 CSS and JS files. Without these files, no Bootstrap components will work correctly. You can find a template with your example code here.
Starter Template with your HTML (modified).
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Col-6 issue</title>
</head>
<body>
<div class="container-fluid" style="border: 3px solid red;">
<div class="row">
<div class="col-6" style="border: 2px solid yellow;">
<img src="https://picsum.photos/id/237/200/300" class="img-fluid d-block" />
</div>
<div class="col-6" style="border: 2px solid green;">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. In vitae turpis massa sed elementum. Placerat orci nulla pellentesque dignissim.</p>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c6c736c6c796e32766f5c2d322d2a322c">[email protected]</a>/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>
Utilize the Bootstrap Starter template. Additionally, there is an error in using the responsive image classes. The deprecated img-responsive
class in Bootstrap version 4 should be replaced with img-fluid
for Responsive Images. Remove the width
and height
attributes from the img tag
for responsive images. Also, consider learning CSS3 flex box
by referring to this guide.
This information should aid you in resolving the issue.