Solution 1 :

Here is implementation:

Ionic 4 should give you warnings that instead of attributes for both align and padding, relevant ion css classes should be used instead:

<ion-row class="ion-align-items-center ion-no-padding"></ion-row>

Can you try this?

Problem :

I have this structure in an HTML of my Ionic 4 project:

<ion-header  ....
<ion-content ....

  <ion-toolbar color="dark">
    <ion-row align-items-center no-padding>
      <ion-col size="10">
        <textarea  autosize maxRows="3" [(ngModel)]="newMsg" class="message-input"></textarea>
      <ion-col size="2">
        <ion-button expand="block" fill="clear" color="primary"
         <ion-icon name="send" slot="icon-only"></ion-icon>

enter image description here

However, as you can see, the object is not vertically centered inside the column. What could be wrong?

.scss file:

#container {
  text-align: center;
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);

#container strong {
  font-size: 20px;
  line-height: 26px;

#container p {
  font-size: 16px;
  line-height: 22px;

  color: #8c8c8c;

  margin: 0;

#container a {
  text-decoration: none;

ion-content ion-toolbar {
  --background: translucent;

.message {
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 4px;
  white-space: pre-wrap;

.other-message {
  background: var(--ion-color-tertiary);
  color: #fff;

.my-message {
  background: var(--ion-color-secondary);
  color: #fff;

.time {
  color: #dfdfdf;
  float: right;
  font-size: small;

.message-input {
  width: 100%;
  border: 1px solid var(--ion-color-medium);
  border-radius: 10px;
  background: #fff;
  resize: none;
  padding-left: 10px;
  padding-right: 10px;

.msg-btn {
  --padding-start: 0.5em;
  --padding-end: 1em;


Comment posted by Rainbow

i’m not familiar with ionic but i think you need to change the flex direction or use margins auto

Comment posted by Josh

Zohir Salak, sorry, that was a typo. It still doesn’t work.

Comment posted by Avocado

are all the elements

Comment posted by Rainbow

if the container doesn’t have a height the vertical centering won’t be visible, also the doc says

Comment posted by Sergey Rudenko

can you share your css ?