Display a list group in two columns using Bootstrap 4's grid system

Is there a way to create a list-group with 2 columns using bootstrap 4?

<div class="categories">
    <h4>Categories</h4>
    <ul class="list-group">
      <li class="list-group-item active">Name 1</li>
      <li class="list-group-item">Name 2</li>
      <li class="list-group-item">Name 3</li>
      <li class="list-group-item">Name 4</li>
      <li class="list-group-item">Name 5</li>
      <li class="list-group-item">Name 6</li>
    </ul>
</div>

making sure it looks similar to

https://i.sstatic.net/tSjSr.jpg

Answer №1

Give this a try

<!DOCTYPE html>
<html lang="en>

<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
</head>

<body>
    <div class="container">
        <h4>Categories</h4>
        <div class="row">

            <div class="col">
                <ul class="list-group">
                    <li class="list-group-item active">Name 1</li>
                    <li class="list-group-item">Name 2</li>
                    <li class="list-group-item">Name 3</li>
                    <li class="list-group-item">Name 4</li>
                </ul>
            </div>
            <div class="col">
                <ul class="list-group">
                    <li class="list-group-item active">Name 1</li>
                    <li class="list-group-item">Name 2</li>
                    <li class="list-group-item">Name 3</li>
                    <li class="list-group-item">Name 4</li>
                    <li class="list-group-item">Name 5</li>
                    <li class="list-group-item">Name 6</li>
                </ul>
            </div>

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

</html>

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

Removing the gaps within table cell contents

Is there a way to eliminate the border space between cells in a table? Despite using cellspacing, I still see a thin white border. Any suggestions on how to fix this? <body> <center><table style="border-collapse: collapse; width:400px; bo ...

Adding space between the cells on the far left and far right of the table and the border

I need some advice on creating a table in HTML where the borders of the leftmost and right most cells do not extend all the way to the edges of the table. Here's an example: | ____ | In this example, the top border of the cells is continuous within ...

Is it advisable to opt for window.webkitRequestAnimationFrame over setInterval?

Trying to figure out the best method for moving game characters in my JavaScript game - should I go with window.webkitRequestAnimationFrame or stick with setInterval? Any advice is appreciated! ...

having difficulty uploading an image on wampserver

I am seeking advice and assistance with an issue I am facing. I am attempting to upload an image, but Wampserver keeps displaying the following error message (Warning: POST Content-Length of 80237 bytes exceeds the limit of 750 bytes in Unknown on line 0 F ...

Encountering an error when attempting to switch to an IFrame using Selenium in C#

When attempting to switch to the iframe, I encountered a "No Such element exception". <div class="panel1" id="list_container" style="height: 181px;"> <div class="control" id="FilteredDashboardList"> <div class="splitter h ...

Repair the masthead background during overscroll

The Dilemma At the top of my webpage, I have a sleek masthead with a captivating background image that scrolls along with the page. However, there is an issue when users overscroll upwards, causing an undesirable white overflow to appear. To rectify this ...

The text displayed on the image is experiencing fluctuations

I am experiencing an issue on my website where the post text fluctuates rapidly when the mouse hovers over the image. I have a site where I display the post text on mouseover of the image. Can someone please help me solve this problem? You can test it by ...

The CSS classes in Bootstrap 4 are not rendering correctly on Chrome browser

I'm a frontend novice, so the solution might be quite simple. This project is using Angular 7. I'm currently following a tutorial on YouTube (https://www.youtube.com/watch?v=nZbZ5AHZJnc&t=1s) on how to integrate Bootstrap with Angular. The ...

Creating a legitimate svg element using javascript

While working with SVG, I had an issue where I added a <rect> element directly into the svg using html, and then created a new element (without namespace) <circle> with javascript. However, the <circle> element did not display in the svg ...

What is the best way to overlay my slider with a div containing content?

In the hero section of my website, there is a slider with 3 slides. I am looking to add a div element that will display content over these slides at all times, regardless of which slide is currently showing. ...

The removal of classList.remove() only eliminates the class itself, not its contents

My goal is to add one class and remove another class when the start quiz button is clicked. While the 'info_box' class is successfully added, the 'start_btn' class does not get removed; it just changes position (from flex to no flex). T ...

Troubleshooting a malfunctioning PHP script that verifies user ranks

I wrote a PHP script to determine the user's rank and grant access to view specific content based on that rank. Unfortunately, the script is not functioning as intended. Regardless of the user's rank, the content is still displayed. Here is the ...

disable full page scrolling on iOS devices

Can you achieve elastic scrolling for a single absolutely positioned div in Mobile Safari without causing the entire page to move up and down? Check out this basic example that illustrates the problem: <!doctype html> <html> <head> ...

Whenever I select the checkbox, it causes my Bootstrap modal pop-up to close unexpectedly

I have created a form in a modal popup with 5 checkboxes where autopostback is set to true. Whenever I click on one of the checkboxes, the modal popup automatically closes. I have also used an update panel and included ScriptManager.RegisterStartupScrip ...

What is the best way to incorporate background colors into menu items?

<div class="container"> <div class="row"> <div class="col-lg-3 col-md-3 col-sm-12 fl logo"> <a href="#"><img src="images/main-logo.png" alt="logo" /> </a> ...

Catalog of items in Mustache

I am currently working on generating HTML content using the mustache template engine. However, I have encountered an issue when trying to render a list of objects. Below is an example of my object: var Prod={ "Object1": { "name": "name1", "cat ...

Tips for maintaining an active link using CSS

I am looking to create a hover effect for links that remains active when the user is on a specific page. Essentially, I want a background to appear behind the link when it is visited. Below is the HTML code: <div class="menudiv"> <div id="menu"& ...

Bookmarklet does not successfully inject jQuery on a specific webpage

Trying to utilize a certain bookmarklet: javascript:void((function(doc){if(typeof jQuery=='undefined'){var script_jQuery=document.createElement('script');script_jQuery.setAttribute('src','https://code.jquery.com/jquery ...

Refrain from showing content beneath a certain element

Is there a way to hide all content that appears after a specific element, such as a particular class of div? The issue I am facing involves using a 1&1 webpage builder with a restrictive layout-template enforced by my boss. I am trying to remove the foote ...

Using data variables as arguments in the style section of Vue2

Suppose we have a data variable and I want to utilize this data variable for styling purposes. data() { return{ selected:{ index: 2 } } } <style> .parent-table >>> .table-row:nth-child(/* here I intend to use ...