Showcasing a set of divs - arranged in rows of three

Utilizing bootstrap 3 to exhibit user contact details on a website has proven to be challenging.

My initial idea was to use the col-md-4 bootstrap CSS class to showcase three contact details per line, but it seems my expectation did not match reality.

The HTML code is set up to only show entered contact information. Users can input anywhere between 1 and 6 contact details. The layout should display a maximum of three contact details per line using the col-md-4 class.

With three contact details provided by the user, the display looks correct:

https://i.sstatic.net/pPPkJ.png

However, when a fourth contact detail is added, it gets placed below the third instead of aligning under the first one. This visual demonstrates the issue:

https://i.sstatic.net/lT6dC.png

This seems like a simple mistake on my part, yet I'm unable to rectify it. Extensive searches on SO & Google yielded no solution, prompting me to seek help through this post.

Below is the snippet of my HTML code:

<div class="live_preview_standard_nac_contactContainer" dir="ltr" style="direction: ltr;">
        <div class="row">
            {{ #if contact_details_phone }}
                <div class="col-md-4 ellipsis" dir="ltr" style="direction: ltr;">
                    <i class="fa fa-phone icon_size20 icon_padding"></i>{{ contact_details_phone }}
                </div>
            {{ /if }}

            <!-- Additional contact details snippets ... -->

        </div>

    </div>
    

And here's an excerpt from my CSS code for reference:

.live_preview_standard_nac_contactContainer {
        padding-bottom: 1px;
    }

    .ellipsis {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Other CSS styles declarations ... */
    

Answer №1

Source: Visit this link for more information

To achieve the layout of your choice, start by creating a container element. Then, create a row element inside the container. After that, add the required number of columns with appropriate .col-- classes. It's important to ensure that the numbers in the .col-- classes always add up to 12 within each row.

Here is an example of HTML code structure:

<div class="container">
  <div class="row">
    <div class="col-*-*"></div>
  </div>
  <div class="row">
    <div class="col-*-*"></div>
    <div class="col-*-*"></div>
    <div class="col-*-*"></div>
  </div>
  <div class="row">
    ...
  </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

Significant empty space to the left of content due to Zurb Foundation

I'm currently utilizing Zurb Foundation within a rails project. My goal is to structure a basic page that consists of a table, text field, and a couple of buttons. However, I am facing a significant gap on the left side of my content, causing the rig ...

Design and execution of webpage structure

My website features a single-page layout with fixed navigation that allows users to easily navigate up and down the page using #. However, when the page loads I want it to display the second section of content instead of the top section. Is there a way to ...

How can I customize the border color and text color of the <TextField/> component in Material-UI without relying on makeStyles?

Can Material-UI be customized using traditional CSS instead of the makeStyles feature? I'm intrigued to learn more about the styling options in Material-UI. I'm aiming to replicate the red style at the bottom using basic CSS techniques. https:/ ...

Manipulating Object origin data

I'm unsure if this can be achieved. I am aiming to create a header and footer that remain the same while only switching the content pages. The resources I have at my disposal cover HTML, JS, CSS, and JQuery. Below is a simplified version of my curre ...

Displaying a cordova camera plugin captured photo within the IMG element

Seeking assistance with the Apache Cordova Camera API to display camera-retrieved images. I am able to capture the image, and the file URL looks like: file:///mnt/.....something.jpg However, I am encountering difficulty setting this image in an existing ...

Is there a way to adjust the size of this map?

I’m attempting to adjust the dimensions of the div.wx-imap-pane.wx-module to a height of 346px and a width of 1727px using greasemonkey, but I’m struggling to make the change take effect. My attempt: div#div.wx-imap-pane.wx-module, div#div.wx-imap-pa ...

I am interested in toggling the visibility of two div elements

I am trying to create functionality where div 2 is displayed when div 1 is clicked, and div 1 is hidden. Then, when clicking on div 2, div 1 will appear again while div 2 disappears. My code attempts to achieve this behavior, but it doesn't seem to w ...

Ways to pinpoint and customize individual components with CSS

As someone who is not very experienced with HTML and CSS, I have a question... I am unsure of the correct terminology, but in the example below, how can I apply CSS to style ONLY the paragraph tags within each element? For instance, how would I write CSS ...

Obtaining the accurate offsetTop and offsetLeft values for an element following a CSS3 rotation

Is there a method to accurately determine the offsetTop and offsetLeft values of an element post-transform rotation? Are there any lesser-known element properties that could be helpful in this scenario? Attached is an image that can provide further clari ...

Having difficulty navigating to a different page in Angular 4

I'm currently attempting to transition from a home page (localhost.com) to another page (localhost.com/listing). Although the app compiles correctly, I encounter an issue where nothing changes when I try to navigate to the new page. My approach has m ...

Integrate the dForm plugin with a convenient time picker widget

Currently, I am attempting to integrate a time picker widget into a jQuery plugin called dForm. The specific timepicker widget can be found at the following link: https://github.com/jonthornton/jquery-timepicker Despite reviewing the dForm documentation, ...

The correct alignment of images is crucial for a website's overall aesthetics and functionality

My column displays images aligned in the center when viewed locally, but the alignment changes when hosted remotely. Here is the image when locally hosted: https://i.sstatic.net/I56Dg.png And here is the remote host image: https://i.sstatic.net/ePoAn.p ...

Tips for overlaying text onto a canvas background image

I'm curious about how to overlay text on top of an image that is within a canvas element. The image is a crucial part of my game (Breakout), so it must remain in the canvas. I've tried adding text, but it always ends up behind the image, which is ...

Automatically refresh browser tabs with the most up-to-date web page

As a newcomer to html, I find it frustrating to have to constantly refresh my browser every time I make changes. I am currently using vs code and wondering if there is another code editor that can automate this process for me or perhaps a different browser ...

The responsive grid in bootstrap-vue can sometimes cause content to be concealed

I am in the process of creating a vue application using bootstrap-vue. Here is a snippet of my template and styles: <template> <div> <b-container class="p-0 mt-3" fluid> <b-row style="height:110px"> ...

Looking to retrieve the <td> element using the class name?

When a specific condition is met in the class name, I want to apply styles to an entire row. The table structure I am working with is as follows: <table> <tbody> <tr> <td><div><span class='level2'></span&g ...

Attempting to incorporate a vibrant hover effect into a sleek carousel design

I am struggling to implement a hover effect with color on an image within a slick carousel on my Wordpress website. I have been exploring various options but haven't found a solution yet. ...

Stacked PNG's in an HTML design

Has anyone been successful in stacking 3 layers of png images on a table? I am attempting to achieve this with a table that has 6 columns. Grey Arrow - Serving as the table background image Red Arrow - Representing a PNG within the table Blue Arrow - Ind ...

What are the steps to format text into 2 columns with a personalized design?

As I develop a website using HTML, CSS, and jQuery, I encountered a layout challenge. The text on the page is designed in a 2-column style, with an image positioned before it. Currently, the structure looks like this: <div> <div style=" ...

Can the w3 validator be configured to disregard PHP tags?

I am facing issues with the online validator flagging errors for my php tags. To validate my HTML, I currently have to manually remove all the php inserts which is quite time-consuming. Is there a more efficient way to handle this problem? Below is an e ...