How can I align Ion-Content to the bottom of the page in Ionic?

I'm having trouble positioning a message input box at the bottom of my page. I've experimented with using align-self-end and creating a css class for ion-footer, but nothing seems to be working.

<ion-content>
<ion-footer align-self-end>
  <ion-toolbar color="light">
    <ion-row align-self-end>
      <ion-col size="10">
        <ion-textarea auto-grow class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
      </ion-col>
      <ion-col size="2">
        <ion-button expand="block" fill="clear" color="primary" [disabled]="message === ''" class="msg-btn"
          (click)="sendMessage()">
          <ion-icon name="paper-plane"></ion-icon>
        </ion-button>
      </ion-col>
    </ion-row>
  </ion-toolbar>
</ion-footer> 
</ion-content>
ion-footer{
    display: flex;
    align-items: flex-end;
    margin: auto; 
    padding-top: .5em;
    padding-bottom: .5em;
  }

Answer №1

<ion-footer> is recommended to be placed outside of <ion-content>

The correct HTML structure should look like this:

<ion-header>
</ion-header>

<ion-content>
</ion-content>

<ion-footer>
</ion-footer>

If you need to add an element at the bottom of the content, consider inserting a textarea as shown below. Avoid placing ion-row inside the ion-toolbar.

<ion-content>
</ion-content>


<ion-footer>
    <ion-toolbar>
        <ion-textarea maxRows="4" [(ngModel)]="message" placeholder="Write a message"></ion-textarea>
        <ion-icon name="paper-plane" slot="end"></ion-icon>
    </ion-toolbar>
</ion-footer>

Answer №2

One alternative approach could involve

.service{
  margin: auto;
  position: absolute;
  text-align: center;
  bottom: 20px;
  width: 100%;
}

<ion-content padding>
  
  ... additional components

  <div class="service">
     <p>a specific message</p>
  </div>
</ion-content>

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

What causes the calculated quantity to not reflect the changes made by the factory update?

I am working with a basic factory setup like the one below: angular.module('posBitcoinApp') .factory('invoiceData', function ($http, $interval) { var blockchainInfoExchangeRates = {}; var getLatestExchangeRates = function() { $h ...

Utilizing the Invision prototype for embedding

They provided me with this code snippet <iframe width="424" height="916" src="//invis.io/U5574OIA3" frameborder="0" allowfullscreen></iframe> However, I am unsure of how to properly embed it. I attempted to insert the line into my website but ...

Eliminating vertical spacing between words with CSS

I am trying to nest a span within a button <span style="font-size: 11px; font-weight: 700; white-space: normal; margin-left: -5px;">UPGRADE PLAN</span> When I use white-space: normal, it breaks the word UPGRADE PLAN vertically. However, I am ...

The error handler in AngularJS $http service is always left wanting for a call

Here's the code snippet I'm currently using: $http .post('/api/login', $scope.user) .success(function (data, status, headers, config) { // code }) .error(function (data, status, headers, config) { // code }); It seems to be functi ...

HTML5 Video Frozen in Place on Screen's Edge

I am encountering a problem specifically on Webkit, particularly in web view on iOS. When I tested it on desktop Chrome, the issue did not appear. Here is the Portrait image and Here is the Landscape image The video seems to be fixed in one position rega ...

What is the best way to utilize Bootstrap's grid columns to adjust the size of X-Editable input fields?

Currently, I am utilizing angular-xeditable, the Angular version of X-Editable. My goal is to modify the input width by leveraging Bootstrap's grid column classes. In a related query titled x-editable - adjusting the width of input field on Stack Ove ...

I can't figure out what's not working with my full-width video cover

I'm having trouble creating a full-width video cover for the header of a website. Can someone help me troubleshoot what I'm doing wrong? Here is a snippet of my code: <section id="home"> <video poster="assets/img/home-bg.png" a ...

HTML card experiencing overlapping problem

I have a website with three columns using Bootstrap that contain images, each with a button in the center. I added a dialog window that should appear when a user clicks on a button within an image. However, the dialog window appears behind the columns and ...

I utilize ng-table for managing data in both admin and user interfaces, with distinct sources. The admin interface displays author data until refreshed

Using ng-table for both admin and user functionality within the same controller and view, each loading data from different URLs. However, there is an issue with data being reloaded from cache when accessing it, that I need to clear when a user logs out. C ...

How can you create a sticky navigation bar specifically designed for horizontal scrolling on a website?

I am facing a challenge with a large table that extends beyond the screen, requiring both horizontal and vertical scrolling. My goal is to create a sticky navbar that remains at the top when I scroll horizontally, but hides when I scroll vertically, only t ...

Difficulty with Bootstrap Carousel (image is displayed but fails to transition/change)

Although I don't have much experience in this, I've searched through various documentations and solutions that have helped others. Unfortunately, I haven't been able to fix my issue, so I decided to create my own post to seek assistance. &l ...

Position the content below a Bootstrap row with the columns above being offset

Having trouble aligning content below a row of anchors/divs that require an offset-md-1. The challenge is making sure the content below aligns with the row above, which has the offset and remains responsive. Adjusting margins on paragraphs causes overflow ...

Exploring the Vertical Metrics of Various Typeface Styles

I'm encountering a problem and struggling to find a solution. I'm in the process of creating a website and incorporating various fonts. My goal is to ensure that every font appears visually similar to the others and align perfectly at the base. ...

AngularJs $resource HTTP status monitoring

As a newcomer to AngularJs, I am delving into the complexities of utilizing $resource to retrieve the HTTP status code that was returned. I have set up a factory and attempted one method to obtain the HTTP header but haven't had any success so far. a ...

incorporating a personalized API feed into a news ticker

Looking for help with setting up a ticker on my website to display headlines from my custom news API. I'm a bit lost on where to start, so any guidance would be appreciated. Here's the API link - API Link Is there a simple solution for this? Cu ...

Customize the drop-down size of an array in AngularJS with array-size customization

I am brand new to the world of angularjs and I have decided to take on the challenge of creating a shopping cart application. So far, everything seems to be going smoothly. However, I have encountered a roadblock. I need to incorporate a 'Quantity&apo ...

Encrypting and decrypting characters such as "é" using EncodeURIComponent and DecodeURIComponent functions

I am facing an issue with my web application that involves a drop-down list containing parameters with accents, such as: "Bonjour/COUCOU SPéCIALISTE/AB12345" When I select this parameter and perform a search, the resulting URL looks like this: abcdefgh. ...

Move the footer down to the bottom of the page

I'm struggling to create a footer that consistently stays at the bottom of the page, regardless of the amount of content on the page. I've tried following various tutorials but haven't had much success. I'm starting to think I must be d ...

How can you make an Angular directive activate only after the scope function in an ng-click handler has been executed?

Scenario I am relatively new to Angular and facing a specific challenge. The goal is to make a directive change the color and add an image to a button. However, I am struggling to get the first if condition to work in my Angular Directive. Issue The ob ...

What is the best way to ensure image alignment is correct before displaying mat-error in Angular Material?

Having an issue with aligning an image with a mat error message in my Angular Material application. I've tried using matprefix but it's restricted to mat-form-field only. Any suggestions on how to properly align the image with the text? HTML < ...