Looking for help with Bootstrap - attempting to make a two-column table using list-group-item styling

Novice programmer seeking assistance with bootstrap4.

I'm attempting to set up a list group item to showcase user reviews.see image description here

I've tried adjusting every possible element.

At first glance, it appears straightforward, but I am stuck.

Would appreciate your thoughts. Do I need specific CSS for this?

<div class="panel-heading">
    <div class="panel-body">
    <div class="list-group">
    {% if comments %}
    {% for comment in comments %}
    <div class="list-group-item ">
    <!--left hand side of table to store username, userstatus and userimage -->
        <div class="col-lg-2 col-md-2 col-xs-2 col-sm-2 col-xl-2">
        <div class="col-lg-12" align="center">
        <p><a href="{% url 'profile' comment.user %}">{{ comment.user }}</a></p>
        </div>
            <div class="col-lg-12" align="center">
            <p class="status">({{ comment.user.status }})</p>
            </div>
            <div>
            <img class="rounded mx-auto d-block" width="64" height="64" src="{{ MEDIA_URL}}{{ comment.user.picture }}"/><p>
            </div>
        </div>
        <!--right hand side of table to store date comment posted and comment -->
        <div class="col-lg-8 col-md-8 col-xs-8 col-sm-8 col-xl-8">
            <div class="col-lg-12" align="left">
        <p>Posted: {{ comment.created}}</p>
        </div>          
        <div>
        <p>{{comment.body}}</p>
        </div>
        </div>
        </div>
        {% endfor %}
        {% else %}
        <p>There are no comments</p>
        {% endif %}
    </div>
  </div>
</div>

Answer №1

It is recommended by Bootstrap to utilize their Cards content container instead of panels for better layout structure. To maintain elements on the same line, ensure they are placed within the same row.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<div class="card">
  <div class="card-body">
    <div class="row">
      <div class="col-sm-2">
        <a href="#">0808148w</a>
      </div>
      <div class="col-sm-10">
      </div>
    </div>
    <div class="row">
      <div class="col-sm-2">
        <p class="status">Current student</p>
      </div>
      <div class="col-sm-10">
        <p>Posted: 20/03/2019</p>
      </div>
    </div>
    <div class="row">
      <div class="col-sm-2">
        <img class="rounded d-block" width="64" height="64" src="https://picsum.photos/64/?random" />
      </div>
      <div class="col-sm-10 card-text">
        Comments...
      </div>
    </div>
  </div>
</div>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<div class="card">
  <div class="card-body">
    <div class="row">
      <div class="col-sm-2">
        <a href="#">0808148w</a>
      </div>
      <div class="col-sm-10">
      </div>
    </div>
    <div class="row">
      <div class="col-sm-2">
        <p class="status">Current student</p>
      </div>
      <div class="col-sm-10">
        <p>Posted: 21/03/2019</p>
      </div>
    </div>
    <div class="row">
      <div class="col-sm-2">
        <img class="rounded d-block" width="64" height="64" src="https://picsum.photos/64/?random" />
      </div>
      <div class="col-sm-10 card-text">
        Comments...
      </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

Inserting a Specific Iframe into a Designated Location in HTML with the Help of Jquery

Currently, I am encountering an issue with placing a dynamically created iframe inside a specific section of my webpage. The iframe is supposed to be contained within a div element named "maps", but instead it is appearing at the bottom of the page.This ma ...

Using Jquery to run a jquery script stored in a variable within jQuery syntax

This question may seem a bit confusing, so allow me to explain further. I am trying to execute a jquery script that is written in a text file obtained through an ajax request. For example, the code I receive from the ajax request looks like this: ($($(" ...

Utilize the Tab feature effectively in Impress.Js

Currently, I have disabled the Tab key in Impress.js so that it only moves to the next slide. However, when I try to focus on links and delete this code to let it behave normally, Impress.js crashes. Has anyone found a workaround for this issue? Appreciat ...

CSS Animations are effective in CodePen, but unfortunately, they do not function properly once integrated into an ASP.Net project

I created a unique design on codepen with a background animation, which functions properly there. However, when I integrate it into my ASP.Net Core project, the animation doesn't work as expected. The file references seem correct because the backgroun ...

What methods can I use to adjust the selected option according to the value in the database?

To introduce you to my work, I have a table filled with data from a database that functions as a CRUD - Create, Read, Update, Delete table. Within this table, there is a column where EDIT and DELETE buttons are located. Clicking on the EDIT button trigger ...

Tips for avoiding whitespace in flexbox as you resize an item

My flex box setup is pretty straightforward: main { width: 660px; height: 100%; display: flex; justify-content: center; align-items: center; flex-direction: column; } When I look at my page, it appears like this: https://i.sstatic.net/JF8KC.j ...

Display modal after drop-down selection, triggered by API response

Currently, I am working on integrating an API to enable users to make payments through a modal. Users should be able to enter an amount and select a payment frequency. I have successfully extracted various payment frequencies from the API response and pop ...

Vuejs unstyled content flash

I encountered an issue while loading a page with Vue. Initially, I am able to access variables like @{{ value }} but once the page is fully loaded, the variable becomes invisible. How can I resolve this issue? I have already included Bootstrap and all scri ...

Tips for maintaining a fixed height for a div while its content is being updated

<div id='wrapT'>some content here</div> <div id='btnsT'> <img id='prev' src='btns/prev_01.png' alt='prev'> <img id='next' src='btns/next_01.png' alt='next ...

What are some ways I can make my content come alive on my website using the Tympanus examples

After spending hours searching for a way to add animation to my content, I finally found a technique that seemed promising. Despite following the same steps as outlined in the tutorial I found, I was disappointed to discover that there was no animation o ...

Can you provide some examples of CSS code snippets?

Can someone share some CSS codes similar to :hover that can be used in the : part for different effects? I tried looking it up but couldn't find much, so any help would be greatly appreciated. ...

Attention: The index value is not defined:

This is the main page with a date picker that links to index.php, where the data table is located. Everything works fine when I select a date, but if I make any changes on the index.php page or try to access it directly, I encounter this error: Notice: ...

Methods for scaling the size of CSS background images

Can anyone assist me with scaling background image size properly? code: http://codepen.io/AnilSimon123/pen/JRBRZa Below is the code snippet: .bgimage{ background:url('http://www.thedesignlove.com/wp-content/uploads/2012/08/free-blue-abstract-vec ...

What is the best way to initiate a slideshow using an external .js file?

Having an issue with my slideshow. When I put the CSS and JavaScript code in the same page, it kind of "works" but quickly goes transparent, which is not ideal for me. I prefer keeping things organized with separate files - one for each. However, when I mo ...

How to use Javascript to pause an HTML5 video when closed

I am new to coding and currently working on a project in Adobe Edge Animate. I have managed to create a return button that allows users to close out of a video and go back to the main menu. However, I am facing an issue where the video audio continues to p ...

What's the best way to position a child fixed DIV in relation to a parent fixed div?

Here is the HTML snippet I am working with: <div class="parent"> <div class="child"></div> </div> The corresponding CSS styles are as follows: .parent { position: fixed; } .child { position: fixed; left: ...

Remove the scrollbar from the iframe and instead display a scrollbar on the page in its place

Currently, I am facing an issue with the vertical scrollbar on an iframe. I want to remove it so that the scrollbar appears on the main page instead. This way, I will be able to scroll the content of the iframe using the page's scrollbar. I managed to ...

The affix feature in Bootstrap's navbar fails to recognize the height of images

My navbar element affixes prematurely when placed below my header element, making it seem as if the image in the header does not exist. The navbar is meant to affix only when it reaches the top, but currently, it is affixing earlier. The code I used sets ...

Get the skin image link from the app folder in Magento

I am attempting to manually insert social icons into my project. projectname/app/design/frontend/projectname/default/template/page/html/footer.phtml This is the HTML code: <a src="../">facebook</a> What is the proper method to link the imag ...

Using clip-path in SVG works perfectly on images, but unfortunately it does not work on div

I came across an interesting example on MDN about using a clip-path SVG on an image. However, it seems that the same clip-path does not work properly when applied to a div. Can anyone shed some light on: The reason why this code is not achieving the inte ...