What could be causing my bootstrap cards to not appear side by side?

Check out my code snippet where I've defined two Bootstrap cards:

<div id="detailPanel" class="col-lg-12">
    <div class="col-lg-12">
        <div class="card">
            <div class="col-lg-6">
                <div class="card-header">
                    <div>
                        Detail
                        @if (@Model.ProjectId != default(int))
                        {
                            <text>- Project #</text>
                            @Model.ProjectId
                        }
                    </div>
                </div>
                <div class="card-body">
                    @*Custom fields*@
                    <div class="editor-label">@*Custom fields*@</div>
                    <div class="editor-field wide-editor">
                        @*Custom fields*@
                        <button id="showChooser" class="icon-button-sm">
                            <span class="fas fa-search"></span>
                        </button> <span id="description"></span>
                        @*Custom fields*@
                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="col-lg-6">
                <div class="card-header">
                    <p>Financials</p>
                </div>
                <div class="card-body">
                   @*Custom fields*@
                    <div id="purchPanel">
                        @*Custom field*@
                        <div id="realEstatePanel">
                            @*Custom fields*@
                        </div>
                        <div class="editor-label">@Html.LabelFor(model => model.PurchasePrice, "Purchase Price")</div>
                        <div class="editor-field">
                            @Html.EditorFor(model => model.PurchasePrice)
                            <button id="realEstateToggle" class="k-button"></button>
                            @Html.ValidationMessageFor(model => model.PurchasePrice)
                        </div>

                    </div>
                    <div id="refiPanel">@Html.EditorEntryFor(model => model.RefinanceAmount, "")</div>
                    <div class="editor-field" id="equityAssetPanel">
                        @Html.EditorFor(model => model.EquityAssetId)
                        @Html.ValidationMessageFor(model => model.EquityAssetId)
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Here is how the page currently looks like:https://i.sstatic.net/WsRbD.jpg
I'm aiming to align them side by side, similar to the example shown on the official documentation here: https://getbootstrap.com/docs/4.0/components/card/

Answer №1

To start, switch out the card and col-lg-6, with the latter serving as the parent element. Next, enclose the col-lg-6 within a row. Refer to the example I've provided below for clarification.

This instance from the Bootstrap documentation demonstrates it quite effectively https://getbootstrap.com/docs/4.0/components/card/#using-grid-markup

<div id="detailPanel" class="col-lg-12">
    <div class="row">
        <div class="col-lg-6">
            <div class="card">
                <div class="card-header">
                    <div>
                        Detail
                        @if (@Model.ProjectId != default(int))
                        {
                            <text>- Project #</text>
                            @Model.ProjectId
                        }
                    </div>
                </div>
                <div class="card-body">
                    @*Custom fields*@
                    <div class="editor-label">@*Custom fields*@</div>
                    <div class="editor-field wide-editor">
                        @*Custom fields*@
                        <button id="showChooser" class="icon-button-sm">
                            <span class="fas fa-search"></span>
                        </button> <span id="description"></span>
                        @*Custom fields*@
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-6">
            <div class="card">
                <div class="card-header">
                    <p>Financials</p>
                </div>
                <div class="card-body">
                   @*Custom fields*@
                    <div id="purchPanel">
                        @*Custom field*@
                        <div id="realEstatePanel">
                            @*Custom fields*@
                        </div>
                        <div class="editor-label">@Html.LabelFor(model => model.PurchasePrice, "Purchase Price")</div>
                        <div class="editor-field">
                            @Html.EditorFor(model => model.PurchasePrice)
                            <button id="realEstateToggle" class="k-button"></button>
                            @Html.ValidationMessageFor(model => model.PurchasePrice)
                        </div>

                    </div>
                    <div id="refiPanel">@Html.EditorEntryFor(model => model.RefinanceAmount, "")</div>
                    <div class="editor-field" id="equityAssetPanel">
                        @Html.EditorFor(model => model.EquityAssetId)
                        @Html.ValidationMessageFor(model => model.EquityAssetId)
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

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

Converting HTML to PDF: Transform your web content into

I have a couple of tasks that need to be completed: Firstly, I need to create a functionality where clicking a button will convert an HTML5 page into a .PDF file. Secondly, I am looking to generate another page with a table (Grid) containing data. The gr ...

apostrophe cutting off a portion of the input field's value

I am facing an issue with a reloaded input box on a web page that is updated through an ajax call. Whenever the input contains a single quote, the rest of the value gets cut off. How can I resolve this problem? The value assigned to myVal dynamically from ...

Scroll bar design that seamlessly integrates with text wrapping when hovered over

In many of the pages on my blog, I have a structure that consists of boxes with a link like this: http://jsfiddle.net/gliu/E32Bh/ The issue I'm facing is that when too much text is added to these boxes, a vertical scrollbar appears only upon hoverin ...

Adjusted the background scale transformation without impacting the content inside the div

My concern revolves around the transform: scale property. I am trying to achieve a gradual zoom effect on my background when hovered over, without affecting the text content. I have omitted browser prefixes for brevity. Below is the CSS code: #cont-nl { ...

Tips for securing data on an aspx page

Forgive me for this seemingly silly question, but, Recently, my client requested encryption for certain information from their payment system in order to prevent users from stealing personal data. The system is web-based and developed using ASP.NET. We&a ...

Adding data from PHP into a designated div element

update: After some trial and error, I managed to find a solution using jQuery and append() methods. From my PHP code, I created an array containing all the necessary information that I wanted to insert into the tab divs. I then encoded this array into JSON ...

Limit the number input to only allow values between 0 and 100

I am utilizing the Number input component from MUI, which includes Increment and Decrement buttons for adjusting numbers. Is there a method to limit the input to only accept values ranging from 0 to 100 ? Additionally, how can I decrease the width of the ...

Is there a way to create more space between the cards in my project?

Could someone help me with separating the cards in my HTML project? I'm new to coding and struggling with this. The cards are too close together for my liking, is there a way to adjust the spacing? Below is the code I currently have: * { box-sizin ...

Ways to ensure a ul li element perfectly fits inside a div element without any spaces

As a newcomer to CSS and HTML, I'm facing an issue with my ul li dropdown menu and login boxes. The background colors are red and blue, but there are gaps within the div that I want to fill with the height of the div. Below is the code snippet: @key ...

Persist the modified contenteditable data into a JSON file by utilizing PHP Ajax

I am currently working on making a webpage content editable using HTML 5 and saving the data in a JSON file for future use. Additionally, I would like to implement AJAX to load only the edited part of the page and have a PHP file modify the JSON file. An ...

Issue with table cell resizing improperly with scrollable pre content

I'm facing a challenge with resizing my table cell correctly within a variation of the "holy grail" layout. The behavior differs when displaying my main content as a block versus a table-cell. The issue seems to stem from having a scrollable pre bloc ...

The second entry is not being styled by CSS, is there an issue with the code in this section?

I am facing a challenge while trying to set the same background image for two div elements: .abc { background: url('images/autogen.png') no-repeat 0px -133px; width: 256px; height: 256px; }; .def { background: url('images/autogen.png' ...

Steps to update the action attribute in a form element upon clicking a button

Within the following code snippet, there are 3 buttons - update, back, and delete. Depending on which button is clicked, the $page variable should be assigned to the action attribute in the form element, with the posted data being sent accordingly. <f ...

Retrieving information from the table based on the user currently logged in

I have a scenario with two different tables, NGO and Volunteer. When a volunteer selects an NGO to work with, I want to display only those volunteers who are interested in the current logged-in NGO. Below is the code snippet I am using: [<?php ...

Guide on how to enable the first dropdown menu item upon clicking in Bootstrap 5

I am using Bootstrap 5 dropdowns and have defined them as follows: <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4a2825253e393e382b3a0a7f647b">[email protected]</a>/ ...

Opening a new window in JavaScript and passing additional parameters

I am facing an issue with my JavaScript link There is a hidden input field named "domain" Below is a div with an onclick script: <div id="button" onclick="window.open('http://www.mylink.nl/?domein=' + document.getElementById('domein&ap ...

The loading feature of jQuery UI Autocomplete - .ui-autocomplete-loading is ingenious

When fetching the XML file for the search box, I would like to apply this css. It currently takes around 3 seconds to load the file. In the autocomplete.js file, I found these two functions: _search: function( value ) { this.term = this.element ...

How can you align a div next to another using the float property in CSS?

/*Custom Styling for Divs*/ #box1 { border: 1px solid; border-radius: 25px; width: 900px; } #box2 { border: 1px solid; border-radius: 25px; width: 430px; } #box3 { float: right; border: 1px solid; border-radius: ...

The image will remain hidden until it is fully loaded and ready to be displayed

I am currently working on a script that involves displaying a loading icon until an image is fully loaded, at which point the loading icon should disappear and the image should be shown. Unfortunately, my current code is not working as intended. Here is a ...

Challenges Faced When Implementing Dropdown Navigation Bars

Whenever the screen width is less than 576px, I notice that the menu icon on my website shifts its position along with the title (FOOD, LLC). How can I resolve this issue? Website: ...