The art of fluidly positioning elements in Bootstrap columns

My goal is to showcase objects in 3 columns using Bootstrap 4. However, when I implement the code provided, the objects are only displayed in a single column, as shown here: example of 1 column layout.

What I actually want is for the objects to be arranged like this (or something similar): sample layout with 3 columns.

<div class="row-mt-5">
          <div ng-repeat="woman in women">
            <div class= "col-lg-4">
                <!--Card-->
                  <div class="card">
                      <!--Card image-->
                      <img class="img-fluid" ng-src="{{woman.image_url}}" alt="{{woman.name}}">
                      <!--Card content-->
                      <div class="card-body">
                          <!--Title-->
                          <h4 class="card-title">{{woman.name}}</h4>
                          <!--Text-->
                          <p class="card-text"> <h5>{{woman.field}}</h5> <br> {{woman.job}}</p>
                          <a href="#!/women/details/{{woman._id}}" class="btn btn-primary">Learn more</a>
                      </div>
                  </div>
                  <!--/.Card-->
            </div>
          </div>
        </div>

I am eager to master the utilization of Bootstrap classes for object positioning.

Answer №1

To begin, it is important to understand the fundamental layout structure. You can explore it here. Remember that defining the grid layout for all screen sizes (sm md lg xl) is crucial, and you can find detailed information in the provided link. Below, you will find a code snippet that addresses your issue. The inclusion of ng-app and ng-controller is for testing purposes, so please disregard them.

HTML:

<div class="container-fluid" ng-app="myApp" ng-controller="MyController">
  <div class="row">
    <div class= "col-4 col-sm-4 col-md-4 col-lg-4" ng-repeat="woman in women">
      <!--Card-->
      <div class="card">
        <!--Card image-->
        <img class="img-fluid" ng-src="{{woman.image_url}}" alt="{{woman.name}}">
        <!--Card content-->
        <div class="card-body">
          <!--Title-->
          <h4 class="card-title">{{woman.name}}</h4>
          <!--Text-->
          <p class="card-text"> 
            <h5>{{woman.field}}{{woman.job}}</h5>
          </p>
        <a href="#!/women/details/{{woman._id}}" class="btn btn-primary">Learn more</a>
      </div>
    </div>
    <!--/.Card-->
  </div>
</div>

JSFiddle: here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are some creative ways to customize the background of a full component?

Is there a way to modify the background color of an entire component? I want the color to cover the full width and height of the component. I attempted using the body tag, but it was ineffective. Do I need to enclose all components in a div and then appl ...

Why is it not possible for me to choose an element after it has been placed within a grid component?

Struggling to eliminate the blur effect on an image inside a grid element? It seems modifying the properties of an element within a grid class is causing some issues. To simplify, I conducted a basic test: I managed to change the ppp2 class when hovering ...

I am experiencing difficulty locating the style.css file within my Node.js/Express application

I am currently working on a Node.js/Express app and I'm facing an issue where my browser is unable to find my style.css file, even though I am using a static file. Here is the directory structure: public -> css -> styles.css server -> server.js vi ...

Switching between languages dynamically with Angular JS using $translateProvider and JSON files

I currently have a collection consisting of 6 different JSON files. en.json es.json fr.json it.json ja.json zh.json An illustration of the data present in each file is as follows (in this instance, considering en.json): { "SomeText": "Test in Englis ...

Utilizing the express framework to dynamically render route requests

I'm interested in trying dynamic routing with the express framework for my Node.js server. Here is an example of how I am attempting to achieve this: <a href="/views/adminpanel?url={{mMenu.WebAddress}}" ng-click="Description(mMenu.WebAddress)"> ...

Evaluating CSS Specificity

Is there a recommended approach for automatically testing css selectors? I am in the process of developing a SCSS framework and I want to integrate automated tests. Specifically, I aim to verify that the css selectors are functioning correctly. For examp ...

adjust bootstrap column width to fill the container

https://i.stack.imgur.com/tCuL6.png I am hoping that this image will provide a visual aid for what I am trying to convey. My goal is to have the arrow and the boxes aligned in a row without any empty space on the right side. As you can see, the leftmost b ...

Verify JSON data from server using AngularJS

My understanding is that in Angular, the HTTP service has two checks for 'success' and 'error' when connecting to a service. I have already handled these checks as my first step. The issue I am facing now is with the data in my JSON fi ...

I have developed a custom jQuery carousel that includes functionality to start and stop the carousel based on specific conditions

I have set up a jQuery carousel that moves to the left when a checkbox is checked, but I need it to stop moving when the checkbox is unchecked. Can someone help me achieve this? $("#checkBox").click(function(){ if($(this).prop("checked") == true){ ...

Tips on styling HTML using a query value in string format

When using ASP.NET razor and SQL Server 2008 R2, I have a local variable declared in the following manner: var tsmMtd = db.QueryValue(" SELECT b.Name, SUM(subtotal) totalSUM FROM DR_TRANS a INNER JOIN Staff b ON a.Salesno = b.Staffno WHER ...

What is the secret to the lightning speed at which this tag is being appended to the DOM?

Have a look at this concise sandbox that mirrors the code provided below: import React, { useState, useEffect } from "react"; import "./styles.css"; export default function App() { let [tag, setTag] = useState(null); function chan ...

<a> slightly off-centered horizontal alignment

I've been trying to center a link using different methods like text-align:center and display:inline-block, but it seems to be slightly off-center. I've attached images along with my code below for reference. Any assistance would be greatly apprec ...

Ensure that the form is validated using ngDialog openConfirm before it can be closed

I am facing an issue with a button that triggers the opening of an ngDialog.openConfirm. In this dialog, there is a form containing a textarea that must have a minimum of 20 characters. Below is a simplified version of the code: someFunction() { let ...

Filtering Array Elements with AngularJS Repeater

Can I customize my ng-repeat to filter through an array or object? Currently, I am populating via an http request like this: <div class="ibox" ng-repeat="data in appraisals track by $index"> However, I am wondering if there is a way to apply a fi ...

deployJava.js injects a new <embed> element into the header section of the webpage

I've ran into an issue with the Java applets on my website. I included the deployJava.js load tag in the head section of the page, but when I look at the resulting HTML in Chrome debugger, this script seems to be breaking my head content and starting ...

Preventing jQuery slideToggle functionality from toggling multiple elements at once

I am currently working on a project where I have a series of images with captions that appear underneath each one. To show or hide the caption for each image, I am using slideToggle when the image is clicked. $('.imageholder').click(function() ...

Angular debounce on checkboxes allows you to prevent multiple rapid changes from

Managing multiple checkboxes to filter a dataset can be tricky. I am looking for a way to debounce the checkbox selection so that the filter is only triggered after a certain period of time, like waiting 500ms to a second after the last checkbox has been c ...

Live server feature in Visual Studio Code is not able to update CSS styles

Here's the problem: I'm encountering a CSS styling issue with the Live Server extension in Visual Studio Code (by ritwickdey). When I launch the live preview, none of my CSS styles are being applied. Although the HTML displays correctly, the CSS ...

Use a service method to update the selected scope variable

Imagine a scenario where 'User' represents a service and 'User.get' is a method that performs a request. <button class="btn" ng-click="User.get(users,'id,uname,email,pw')"> <p>{{users}}</p> How can I utiliz ...

Converting PDF files to JSON in ASP.NET and transferring them to AngularJS using Base64 does not result in identical files

After encoding a PDF file as Base64 and assigning it to a property of my model object in ASP.NET WEB API, the JSON response is received by my AngularJS client application. However, upon saving the file, I noticed that the file size increases by one and 1/3 ...