Ionic 3!! a slide + two buttons down side by side

Asked

Viewed 786 times

-1

I want to create a slide with two buttons below. But I managed to put the two buttons at the bottom side by side, but the slide doesn’t work when I try to move to slide 2, 3.

<ion-slides id="slide">

  <ion-slide style="background-color: white">
    <h2>Slide 1</h2>
  </ion-slide>

  <ion-slide style="background-color: white">
    <h2>Slide 2</h2>
  </ion-slide>

  <ion-slide style="background-color: white">
    <h2>Slide 3</h2>
  </ion-slide>

</ion-slides>

<ion-content >

  <button id="Entrar">Entrar</button>
  <button id="registrar">Registar</button>


</ion-content>

Code css

#Entrar {
  list-style-type: none;
  margin-top: 620px;
  height: 50px;
  width: 188px;
  float: right;
  font-size: 25px;
  background-color: rgb(0, 89, 255);


}
#registrar{
  list-style-type: none;
  margin-top: 620px;
  display: inline-block;
  height: 50px;
  width: 187px;
  background-color: rgb(0, 89, 255);
  font-size: 25px;




}

1 answer

0

Good afternoon. From what I understand you want to have a slide and below this slide you want to add 2 buttons.

I did using the components that come along with Ionic 3, in case you have already used bootstrap 3 is easier to understand.

I deleted the classes I had and created only one class .estilo-slide To determine a slide height, you can change or remove if you want, depending on your use. Already in HTML I simply added some classes that are native to Ionic to make development more agile.

I created the div before the buttons to place the native class text-xs-center that centralizes the elements within the div, in this case its buttons.

Already on the buttons I used class="pt-xs--4" ion-button color="primary" which means respectively 20px/4 padding-top, ion-button call Ionic button and finally the button color.

Everything I said here is on documentation of Ionic 3.

The final code went like this:

HTML:

<ion-content>
    <ion-slides class="estilo-slide">

      <ion-slide style="background-color: white">
        <h2>Slide 1</h2>
      </ion-slide>

      <ion-slide style="background-color: white">
        <h2>Slide 2</h2>
      </ion-slide>

      <ion-slide style="background-color: white">
        <h2>Slide 3</h2>
      </ion-slide>

    </ion-slides>

    <div class="text-xs-center">
      <button class="pt-xs--4" ion-button color="primary">Entrar</button>
      <button class="pt-xs--4" ion-button color="secondary">Registar</button>
    </div>

</ion-content>

CSS:

.estilo-slide{
    height: 50%;
}
  • Your example worked. however the button is not aligning on the slide. could help me how to do this?

  • @W.Israel Would you like the buttons to stay inside the slide?

  • That’s right, for example, has an image in the center, with some titles, and the buttons below it

  • as you did to use the bootstrap with Ionic?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.