Design of list items using card elements

Struggling with creating a card list design. I want to use MDB5 (utilizing Angular and the MDB5 package - ) but here's the concept:

Imagine a white page where within a grey background, there is a list of item cards. Each card consists of an image on the left side, a column for item name and text in the middle, and a line followed by additional text on the right.

Here is my initial attempt at CSS styling:

.block {
overflow: hidden;
background: #ffff;
padding: 1rem;
margin: 0 0 1rem 0;
}
.block img {
 width: 75px;
height: 75px;
float: left;
margin: 0 1rem 0 0;
}
.block h2 {
  margin: 0 0 0.5rem 0;
}

And the corresponding HTML structure:

<div class="row">
<div class="block">
    <img src="https://mdbootstrap.com/img/Photos/Others/placeholder7.webp" alt="">
    <h2>{{jobFieldDescription.naziv}}</h2>
    <p>{{jobFieldDescription.kratekOpisPoklica}}</p>
</div>
</div>

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

Answer №1

If you're looking for a way to structure your content, utilizing CSS grid may be the optimal choice.

To start, wrap your title and description within a 'div' element for easy styling.

Next, apply these styles to '.block':

.block {
  display: grid;
  grid-template-columns: 100px 1fr;
}

The 'grid-template-columns' rule will allocate 100px to the first column and allow the second column to fill the remaining space.

Incorporating a third column is achievable by adding elements inside '.block' and adjusting the size in 'grid-template-columns' accordingly.

Feel free to experiment with the entire setup provided below:

.block {
  overflow: hidden;
  background: #ffff;
  padding: 1rem;
  margin: 0 0 1rem 0;
}
.block img {
   width: 75px;
  height: 75px;
  float: left;
  margin: 0 1rem 0 0;
}
.block h2 {
  margin: 0 0 0.5rem 0;
}
/*NEW STYLES*/
.block {
  display: grid;
  grid-template-columns: 100px 1fr 100px;
}
<div class="row">
  <div class="block">
      <img src="https://mdbootstrap.com/img/Photos/Others/placeholder7.webp" alt="">
    <div>
      <h2>Lorem Ipsum</h2>
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam in lorem sit amet leo accumsan lacinia. Etiam sapien elit, consequat eget, tristique non, venenatis quis, ante. Proin in tellus sit amet nibh dignissim sagittis.</p>
    </div>
    <p>Same items: XX</p>
  </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

AngularJS's ng-repeat feature is not properly re-embedding tweets

In my project, I am utilizing angularjs to showcase tweets. The implementation involves using ng-repeat alongside a filter that is directly linked to the state of a checkbox. When the checkbox is checked, the filter returns all the tweets (the default beha ...

Table Spacing Problem

Check out my website here: I am trying to introduce some spacing between each column element where the coupon ends and the following business name is displayed. It seems like adding a line break is causing issues with the layout. Here is the code snippet ...

What is the significance of positioning a:hover after a:link and a:visited?

While studying CSS, I encountered a confusing rule that states ':hover' must come after ':link' and ':visited'. In practice, to visit a link we first need to click on it, and in order to click the link, we usually hover over ...

Automatically activate a button when it comes into view while scrolling

I am currently working in Joomla, which makes it challenging to create a fiddle, but here is the concept: My website displays a mosaic grid of 12 articles upon loading, along with a 'Load More' button. When this button is clicked, an additional ...

Setting the initial position for an SVG path

Working on a unique loading animation with 3 shapes that will scale as they follow a path. Each shape begins from a different starting point but follows a similar path. Shapes and paths were created in Illustrator and exported as SVGs. See below for an exa ...

The mat-menu generated with ngFor fails to activate the click function

I'm encountering difficulties when implementing a mat-menu using *ngfor I have consulted this response How can I utilize *ngFor with mat-menu and mat-menu-item? and although I believe I am following the same approach, I am still experiencing errors. ...

Customize the Carousel navigation arrows in Bootstrap 3

Greetings everyone, I am currently utilizing Bootstrap's Carousel options and I am looking to change the appearance of the arrows as I find them unattractive. My desired look for the arrows is as follows: https://i.sstatic.net/Rz9Mb.png However, I ...

Enhancing ag-grid with alternating row group colors following row span

My data structure is shown below: https://i.stack.imgur.com/fy5tn.png The column spanning functionality in ag-grid is working for columns 1 and 2 as expected. However, I am looking to implement alternate row colors based on the values in column 2 (animal ...

MUI Datepicker options for selecting dates

Is there a way to selectively enable certain dates and disable all others in the MUI Datepicker? For example, I need to only allow dates that are 7 days later or earlier to be selectable, while all other dates should be disabled. How can this be achieved? ...

Rendering images in Next.js version 10

Just recently, Next.js version 10 was launched featuring the latest Image element, making it a great asset for websites that heavily rely on images! When I receive an HTML response from the server, it looks something like this: HTML = "<div> &l ...

Is there a way to position labels above their corresponding elements using this customized input style?

My CSS for styled inputs has become too complex, making it difficult to remove and fix certain elements. Specifically, I am facing issues in getting labels positioned above my input fields, select options, and output section. /* Cus ...

Troubleshooting HTML Label Problems

I am facing an issue with my custom labels. .label-ras{ padding:3px 10px; line-height:15px; color:#fff; font-weight:400; border-radius:5px; font-size:75%; } .label-primar{background-color:#5c4ac7} <span style="background- ...

Ways to improve the quality of a blurred photo

I've recently put together a test landing page using bootstrap: Upon visiting the site and viewing the iPhone screenshot, it's clear that the text on the screen is quite blurry. Interestingly, by simply resizing the browser window and then maxi ...

Can VueJS bind the SVG fill attribute with url() when using VueJS?

I am facing an issue with dynamically binding the fill attribute of an SVG rect element in VueJS. To illustrate this problem, here is a simple VueJS component that I have created (also accessible on codepen) <template> <div> <!-- this exa ...

The webpage is inaccessible only on mobile Safari, with an error message indicating a lack of internet

Initially, I do not possess an iPad, however, some clients have reported an unusual issue with one of my websites on the iPad. They are unable to access any page on the website, instead encountering a blank page with the error message: "Safari cannot open ...

Changing the caret position in a contenteditable div using HTML React

In a recent project I worked on, I included contenteditable divs. Whenever the enter key is pressed within one of these divs, it splits into two separate contenteditable divs. However, after React re-renders the components, the caret tends to go to the beg ...

How to prevent JQueryUI dialog from drifting off the browser window

Currently, I am utilizing JQueryUI with dialogextend on a Bootstrap template called Shards UI. An issue that I have encountered is that the dialog has the ability to move outside of the window, resulting in scrollbars appearing on the webpage: https://i. ...

Delete the div if it exists following another div and place it within the main div

<div class="error"> <input type="text" name="email"> <div class="error-message">Please Enter Email</div> </div> <div class="i-icon-div">Lorem Ipsum</div> I am trying to identify the div with the class of i-icon-di ...

Horizontally align the label with the Checkbox

Hi everyone, I'm new to this forum and I've encountered a problem that I am struggling to resolve. The issue lies with a table containing a checkbox list. Initially, everything looks fine when I use: display:inline-block; However, on small ...

What is the best way to achieve rounded table borders without duplicating them or relying on border-collapse?

After discovering a helpful Stack Overflow answer regarding rounding table corners, I attempted to implement the provided CSS code: /* table { border-collapse: collapse; }*/ table, tr, td, th{ border: 1px solid; text-align: center; /*paddin ...