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

Updating of an Angular Directive within a nested Directive ceases once the inner Directive has been modified

Encountered a challenge with directives nested within each other in AngularJS. The issue is that both directives share the same property through a service and have an input to modify this property. The outer directive uses "transclude" to include the inner ...

Error message: When initiating AJAX requests in ASP.NET, the function is not defined for undefined

I recently followed a tutorial on creating AJAX requests for CRUD operations in an AngularJS application. However, upon trying to perform an AJAX request to retrieve data from the database, I encountered the following error when launching my application: ...

Transferring Data from Controller to HTML in AngularJS Version 1

Recently, I started working with angularjs on a new project that involves three main HTML files. The first file is index.html, which contains the ng-view directive. The second file is home.html, where various products are displayed from a database. Each pr ...

Text affected by mix-blend-mode glitch

Currently, I am experimenting with knockout text using the mix-blend-mode property. An interesting issue arises when I examine the responsiveness of my design by utilizing Developer tools in the browser console - there are faint lines that momentarily appe ...

challenges arise when using star icons to rate items visually, as the corresponding hidden values for backend processing are linked to radio input types

Hello, I am trying to retrieve the value of an input type radio by clicking on a star image visually. I have been successful in this, but I am having trouble resetting the star image in another row. You can view a demo of this here. I will explain what I ...

What is the process of parsing a Java property file in AngularJS?

Is it possible to access a properties file from an AngularJS application that is located outside of the web server? For example, in Java we can access a property file deployed separately from the project. Is there a way to achieve this in AngularJS? I at ...

Anticipated a JavaScript module script, but the server returned a MIME type of text/html as well as text/css. No frameworks used, just pure JavaScript

I have been attempting to implement the color-calendar plugin by following their tutorial closely. I have replicated the code from both the DEMO and documentation, shown below: // js/calendar.js import Calendar from '../node_modules/color-calendar&ap ...

Tips for ensuring a div stays centered while resizing the window

When I resize the window, the div tab on the right side of the screen moves to the bottom right. How can I make it stay in the middle regardless of screen size? I've tried using margin-left:auto and margin-right:auto but it didn't work. Changing ...

"Exploring the use of AngularJS for accessing both localhost and remote

On my page, there is a button and a form. Initially, only the button is visible because the form is hidden using an ng-hide condition (link to third party website). When you click the button, you will be redirected to another page for login. Once logged in ...

Best practices for handling http requests in each individual route of AngularJs

Just starting out with AngularJs and attempting to set up multiple routes with different $http requests. I'm facing an issue where the page content loads late after a route change. I've come up with a workaround, but I feel like there might be a ...

Filtering data in AngularJS by parsing JSON records

I have a JSON file containing restaurant information and I need to display the data by grouping them based on their respective address fields. For example, all restaurants with the address 'Delhi' should be shown first, followed by those from &ap ...

Tips for storing a client's date information in MongoDB as an actual date value?

For my web project, I am using Node.js and Angular.js. I have noticed that when a date is created on the server using new Date() it is saved as a Date type (for example, 2015-04-08 04:15:18.712Z displayed as Date in Robomongo). However, if the date is crea ...

Showing a div with a smooth fade-in effect while switching its display property to inline using jQuery

Currently, I am working on a project that involves implementing a "side pop up". To ensure it doesn't flicker like it does with jQuery's "hide()" method, I want to start by setting the display property to none using CSS. My main question is: - Ho ...

Having difficulty sending a message from an AngularJS application to an Angular 10 application through an iframe

I have two applications running locally - one is an AngularJS application and the other is an Angular 10 application. I am trying to access a page from the Angular 10 application using an iframe and send a message to it from the AngularJS application. How ...

Activate search bar by clicking on it

I am currently attempting a basic jQuery example to expand a search bar on mouse click, but for some reason, my code is not working as expected. I have a simple jQuery function to display the input field when the button with the class "expand" is clicked, ...

What is the best way to organize data that has been refined?

I have a dataset that can be filtered to display only the rows with "Color" data when selecting "Color Only" from the sort list. Here is the code I am using: <label>Sort By:</label> <select ng-model="orderProp" class="form-control" tabindex ...

Can you identify the origin of the inclusion of a .php file?

Is there a way to automatically determine if a PHP script is being accessed directly as an HTML page, used as a JavaScript file, or utilized as a CSS Stylesheet? I'm looking for a solution that doesn't involve GET variables or setting a flag wit ...

Retrieve the red, green, and blue components of a color in the RGB format

When I retrieve "rgb(18, 115, 224)" from a DOM element, I need to convert this color to hexadecimal in order to assign it to a span element. To get the hexadecimal equivalent of the color, I can use the following code snippet: "#" + componentToHex(r) + co ...

What are the best methods for ensuring a website maintains consistent visibility across all different screen sizes?

Recently, I created a website tailored for a viewport size of 1366px by 768px. My goal is to maintain the same design regardless of the browser window size without implementing responsive design techniques. For instance: When viewing the website on a 360 ...

Collapsed Bootstrap 5 select drop-down featuring the multiple attribute

I am facing a challenge with using the select element along with the 'multiple' attribute. My aim is to have it collapsed by default and expand only when the user clicks on it. Unfortunately, Bootstrap 5 no longer supports the multiselect feature ...