Tips for customizing bootstrap cards to display on a single row with four columns

I've been working on my Angular application and I'm using a Bootstrap card to display some information.

Unfortunately, I can't seem to get the design to look how I want it to, even after trying multiple approaches.

The component.html code is:

<div class="bs-example">
    <div class="card" id="dd" style="max-width: 800px;">
        <div class="row no-gutters">
            <div class="col-sm-3" >
                heading-1
            </div>
            <div class="col-sm-3">
                <div>heading-1</div>
 <div class="col-sm-3">
                <div>heading-3</div>

                <div class="card-body">
                    <h5>info-1</h5>
                                        <h5>info-1</h5>

               </div>
            </div>
 </div>
</div>

The component.css code is:

body{
background-color: #2d3436;
background-image: linear-gradient(315deg, #2d3436 0%, #000000 74%);
color:white;
}

.bs-example{
        margin: 20px;        
    }

   #dd{
    background-color: #2d3436;
background-image: linear-gradient(315deg, #2d3436 0%, #000000 74%);
color:white;
font-weight: bold;
border-bottom: 1px solid grey;

   }

I'm aiming to display four headings (heading-1, heading-2..) in a single row, with corresponding info and borders below each one. Then in the next row, more info under each heading should be displayed.

If anyone could offer advice or assistance with this Bootstrap layout, as I'm new to using it, that would be greatly appreciated.

Answer №1

<div class="bs-example">
<div class="card" id="dd" style="max-width: 800px;">
    <div class="row no-gutters">
        <div class="col-sm-3" >
            <h5>Title One</h5>
            <div class="card-body">
                //some information goes here
            </div>
        </div>
        <div class="col-sm-3" >
            <h5>Title Two</h5>
            <div class="card-body">
                //some information goes here
            </div>
        </div>
        <div class="col-sm-3" >
            <h5>Title Three</h5>
            <div class="card-body">
                //some information goes here
            </div>
        </div>
        <div class="col-sm-3" >
            <h5>Title Four</h5>
            <div class="card-body">
                //some information goes here
            </div>
        </div>
    </div>
</div>

Answer №2

Have you included the bootstrap CSS file anywhere in your project? It's important to do so in order for the styling to take effect. One way to do this is by importing it directly into your HTML file, like this:

<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">

Alternatively, you can import it in your CSS file like this:

@import "~bootstrap/dist/css/bootstrap.css"

Answer №3

Almost there! Make sure to close your div tags and place your heading within them. Here is a slightly modified version:

<div class="bs-example">
    <div class="card" id="dd" style="max-width: 800px;">
        <div class="row no-gutters">
            <div class="col-sm-4">
                <div>heading-1</div>
            </div>
            <div class="col-sm-4">
                <div>heading-2</div>
            </div>
            <div class="col-sm-4">
                <div>heading-3</div>
            </div>
            <div class="card-body">
                <h5>info-1</h5>
                <h5>info-2</h5>
            </div>
        </div>
    </div>
</div>

I made some adjustments by adding closing tags for the col classes and changed "heading-3" to "heading-2" as you only have 3 headings. Give this a try!

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

How to style the first dropdown value in AngularJS to appear bold?

Is there a way to style only the first value in a dropdown list as bold without using jQuery? Here is the code for the dropdown: <div class="col-xs-3"> <select-box id="ad-version-select" options="curItem.stats.version" model="state.version" i ...

Filter Algolia results by radius using geolocation

Incorporating Algolia for full text search in my Ionic project alongside Firebase has been a game-changer. I can easily search and filter all objects within my project. However, I encountered an issue when implementing 'aroundRadius' as it seems ...

How can I prevent scrolling while a loader is displayed during page loading?

How can I disable scrollability on my personal website when the page is loading with the loader wrapper? I have tried using overflow: hidden; in the CSS but it didn't work. The loader is set to display for 2.5 seconds. Any suggestions on how to achiev ...

Utilizing JQUERY to modify the 'top' attribute upon clicking

I am attempting to implement a vertical scroller using jQuery, but I'm encountering difficulties with my code. function scrolldown() { var newtop = $('.scroll-content').css('top') + '250'; $('.scroll ...

Having trouble retrieving the URL from the router in Angular 2?

Whenever I try to access the URL using console.log(_router.url), all it returns is a / (forward slash). Here is the code snippet in question: constructor( private el: ElementRef, private _auth:AuthenticationService, @Inject(AppStore) private ...

Angular Observable returning null results

After spending some time on this issue, I am still puzzled as to why I am consistently receiving an empty observable. Service: import { Injectable } from '@angular/core'; import { WebApiService } from './web-api-service'; import { Beha ...

Implementing a Moving Background Image with CSS3 or jQuery

I am facing an issue with a background image that has a file size of 4+ MB in PNG format. My website is a single page website and I want to use this background image, but I'm unsure how to go about it. Is there a way to reduce the size of the image s ...

Issue with Angular 4 Bootstrap Carousel

I encountered a console error that I couldn't resolve while working on my project. The technology stack involves Angular 4 and Bootstrap. Unfortunately, my frontend developer is unavailable this weekend, and I'm unsure if there are any missing d ...

Adaptive design that uses identical HTML for both desktop and mobile versions

I'm currently working on a project using Bootstrap 4 to create a responsive design, but I'm facing some challenges. I managed to achieve the desired layout on CodePen, but I'm struggling to find a way to avoid repeating the code for both de ...

Adjusting the visibility of a div as you scroll

I'm trying to achieve a fade-in and fade-out effect on div elements when scrolling over them by adjusting their opacity. However, I'm facing difficulties in getting it to work properly. The issue lies in the fact that my div elements are positio ...

Combining two images using HTML and CSS resulted in conflicts when attempting to overlay any additional elements

I have managed to overlay two images successfully, but I am experiencing conflicts when trying to do the same with other div images. Here is the code on jsfiddle: https://jsfiddle.net/cLew1t2v/ and here is the code snippet: <div> <div style ...

Utilizing jQuery to consistently position an element next to another regardless of its properties

Discovering this website has been a delight. As a novice programmer, I am struggling to grasp the concept of positioning one element next to another regardless of the preceding element. For instance, If Element A can hold any value, And if Element B resem ...

Close the modal when the submit button is clicked and the Ajax request is successful

I have encountered a similar issue to others on StackOverflow, but I am struggling to implement the suggested solutions in my specific case. Currently, I have a modal in my view: <div id="createFolderModal" class="modal"> <div class="modal-dialo ...

After reducing the size of the table, the data spills over

Hey there, amazing individuals of the internet! Hope you're all doing well today. I've encountered a rather perplexing issue that's got me stumped. So, here's the situation - I have this table full of data and I want it to initially be ...

Problem encountered when attempting to insert a new division into an existing flexbox container

I'm in the process of designing a basic login page using HTML/CSS. To center the box on the screen, I opted for a flexbox layout. So far, I have successfully positioned the Username/password fields and login button just the way I want them. The only t ...

Display Navigation upon clicking a designated button

Seeking a way to automatically navigate to the second tab after submitting content in the first tab using nav-link. <ul class="nav nav-tabs" id="myTab" role="tablist"> <li class="nav-item"> <a class="nav-link active" id="home-tab" dat ...

Fluid background images frame the header on either side, with a void of background in the center

I am in need of a header that spans the entire width and is divided into 3 columns, with background images only in the 1st and 3rd columns. Cross-browser compatibility is crucial for this solution. The first column should have a background image and be ...

"Efficiently Distributing HTTP Requests Among Simultaneous Observers using RxJS

Currently, I am working on a feature in my Angular application that requires handling multiple concurrent fetches for the same data with only one HTTP request being made. This request should be shared among all the subscribers who are requesting the data s ...

Ensuring that a "position: fixed" div stays horizontally aligned when the window is resized

I am working on a responsive two-column website with a fixed sidebar that changes its position when scrolling. Here is the CSS styling: #sidebar { padding: 5px; width: 200px; float: left; background-color: yellow; } .fixed { position: fixed; padding: 5p ...

"Customizing the topbar of Twitter Bootstrap for right-to

Attempting to implement twitter bootstrap for a top navigation bar on my master page. http://jsfiddle.net/ZqCah/1/ Encountering some issues and seeking assistance: 1- Desiring to switch the direction of all content to right-to-left (rtl). This would me ...