How can the spacing between Angular Material's mat-card-content and mat-card-actions be adjusted?

I am creating a mat card layout where there are two separate cards within the main card's content section. However, when I add a button for the actions section of the main card, there is no spacing between these two sections. How can I create a vertical space between the mat-card-content and mat-card-actions components?

app.component.scss

.Details {
  padding-top: 50px;
  padding-bottom: 50px;
  padding: 100px 250px;
  text-align: center;
  margin-left: 10%;
  margin-right: 10%;
  width: 80%;
  height: 50%;
}

.seatsAvailable {
  float: left;
  width: 45%;
  // margin-right: -50px;
}

.ticketPrice {
  float: right;
  width: 45%;
  // margin-right: -50px;
}

app.component.html

<div class="Details">
  <mat-card>
    <button mat-icon-button><mat-icon>arrow_back</mat-icon>Back</button>
    <mat-card-header>
      <mat-card-title>Name</mat-card-title>
      <mat-card-subtitle>Status value</mat-card-subtitle>
    </mat-card-header>
    <mat-card-content>

      <mat-card class="seatsAvailable">
        <mat-card-header style="text-align:center; margin-left: 60px;">
          <mat-card-title>Seats</mat-card-title>
        </mat-card-header>
        <mat-card-content>
          <strong>Seats value</strong>
        </mat-card-content>
      </mat-card>

      <mat-card class="ticketPrice">
        <mat-card-header style="text-align:center; margin-left: 60px;">
          <mat-card-title>Ticket Price:</mat-card-title>
        </mat-card-header>
        <mat-card-content>
          <strong>Ticket Price value</strong>
        </mat-card-content>
      </mat-card>

    </mat-card-content>
    <br>
    <mat-card-actions style="margin-top:50px; margin-bottom: 50px;">
      <button mat-button style="border: 1px solid rgb(77, 40, 146);">Result msg</button>
    </mat-card-actions>
  </mat-card>
</div>

Answer №1

Give this code a shot, and if it doesn't do the trick, feel free to create a stackblitz with a live example:

<mat-card-actions style="width: 100%;display: inline-block;">
      <button mat-button style="border: 1px solid rgb(77, 40, 146);">Message displayed</button>
</mat-card-actions>

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

How to eliminate the space between text and list-style-image in CSS

My ul list items have an image added using the list-style-image property. Here is an example of what I have done: JSFiddle ul { list-style-image: url('http://placehold.it/50x40'); } <ul> <li>Coffee</li&g ...

Prevent event propagation when a CSS pseudo-element is active

In my project, there are two elements: .parentElement and .childElement. Both have the :active implemented to appear darker when pressed. The .childElement is nested inside the .parentElement. I am looking for a way to prevent the .parentElement:active fr ...

Create dynamic cells for CSS grid using JavaScript

I have been manually generating grid cells in a specific pattern by copying and adjusting <div> elements. Although this method works, I am interested in creating an algorithm that can automatically generate the desired layout. The left box in the exa ...

Trouble with querying NG elements using "queryAll(By.css)" in Angular and Jasmin unit testing

I've encountered an unusual problem that needs to be resolved for me to successfully complete a unit test for a project I'm currently engaged in. Here is what my unit test currently looks like: it('should display the navbar list', ...

What are the benefits of incorporating component A into component B as a regular practice?

I am considering creating an instance of Component A within Component B, but I'm unsure if this is a best practice in Angular or if it will just cause confusion. Component A: This component generates a modal window asking the user to confirm file de ...

Error: The StsConfigLoader provider is not found! MSAL angular

I am currently using Auth0 to manage users in my Angular application, but I want to switch to Azure Identity by utilizing @azure/msal-angular. To make this change, I removed the AuthModule from my app.module and replaced it with MsalModule. However, I enco ...

State in Angular stubbornly refuses to switch despite condition changes

Here is the Typescript code, followed by the HTML: public verifySelection() { let choice = false; if (typeof this.formUser.permissionsTemplateID === undefined) { choice = true; } return choice; } <div class="form-group" ...

Observable function encountering difficulties returning nested values

I've been working on a function that returns an observable. test(id: int): Observable<Group>{ this.http.get('test/').subscribe( (result:any) => { resultingVal = Group.fromJson(result.group); }); } Right now, the function ...

Can you help me create a CSS Toggle similar to this design?

I am currently working on a website and I need to create a FAQs page with a specific layout. When a user clicks on a question (Q), the answer (A) should open smoothly using jQuery animation. Only one question should be visible at a time. If a user clicks ...

Encountering difficulties with the functionality of Google Places API

I am attempting to incorporate the autocomplete functionality of Google Places API into a text field. Below is the code I have implemented: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"> </script> <script ...

Having Trouble with Angular2: Nesting a Child Component?

Working with angular 2 has been a fun experience for me over the past few days. I've been attempting to insert a child selector into a parent template, but it seems more challenging than I expected. Every time I try, I encounter the following error: ...

Guide to assigning IDs to multiple paragraphs within a parent element using a for loop

Is there a way to use a for loop to set ID for each <p> inside a <div> element? HTML <div id="article"> <p>1</p> <p>2</p> <p>3</p> <p>4</p> <p>5</p> ...

Implementing delayed loading of Angular modules without relying on the route prefix

In my application, I am using lazy loading to load a module called lazy. The module is lazily loaded like this: { path:'lazy', loadChildren: './lazy/lazy.module#LazyModule' } Within the lazy module, there are several routes def ...

Unleashing the Power of RxJS with OR Conditions

I am working with two Observables. For instance, I am waiting for either an HTTP POST call or a WebSocket call to return so that I can proceed. Once either call returns, I need to verify the information until a certain condition is met. In the following e ...

What steps should I take to change the orientation of these items from vertical to horizontal display?

I'm struggling to get these items to appear horizontally (side by side) instead of vertically on my webpage. They are linked to a database, hence the PHP code included here. If you need more information, please feel free to ask. body { font: no ...

Tips for generating an HTML template as a string using jQuery

I have developed a dynamic modal using plain JavaScript, triggered by a button click. This modal is controlled based on the attributes `data-open-hours` and `data-closed-hours` in the HTML. If you take a look at my demo, you will notice an issue. Let me e ...

What are the best ways to troubleshoot my Angular 2 project?

I've been searching for my TypeScript files in the console, but they're not showing up. I've tried everything to debug my Angular 2 project, but no luck. I can't move forward without debugging, can anyone lend a hand? ...

Error: The @use directive must come before any other rules in Angular

Error message: Issue: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): Error Details: HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js) ...

What is the best way to choose $(this) within a JavaScript expression inside a template literal?

Is it possible to use template literals in the append method and get the index of the row generated? I understand that calling "this" inside the function selects the specified selector passed as an argument. $(document).on('click', '.ad ...

Trigger a (click) event on the MatTab in Material design

I have a dynamic loop through tabs and I want to be able to trigger a (click) event in order to load different options when a tab is selected. Is it not possible to use a simple click event on dynamically created tabs? I tried using (selectChange) on the ...