We are trying to create a login form with rounded inputs. The problem is that after adding border-radius to inputs the login button becomes longer than inputs themselves. Here is the code:
<div class="appForm" ion-fixed padding margin-bottom style="position: absolute !important; top: 0%; bottom: 0%; left: 0; margin-bottom: 1%;">
<div class="logo">
<h2>Chat App</h2>
</div>
<ion-list style="margin-top: 43% !important">
<ion-item style="">
<ion-input class="input-field" [(ngModel)]="email" name="username" type="text" placeholder="Email"></ion-input>
</ion-item>
<ion-item>
<ion-input class="input-field" [(ngModel)]="password" name="password" type="password" placeholder="Password"></ion-input>
</ion-item>
<button ion-button block class="login-button" (click)="LoginUser()">Login</button>
<p class="signin">
<button ion-button block clear (click)="RegisterPage()">Sign Up</button>
</p>
</ion-list>
</div>
Also here are the styles:
ion-item {
background-color:transparent !important
}
.input-field {
border:2px solid;
border-radius: 20px;
color: color($colors, light) !important;
}
.login-button {
text-transform: none;
border-radius: 20px;
background:linear-gradient(to right, #DD2476, #FF512F);
color: color($colors, light);
margin-top:15px !important;
}
...
...
How can we make the login button on the same width as inputs?
As you added your ion-input in ion-item it will add default 16px padding from left.
So either you add your button into <ion-item> like below
<ion-item>
<button ion-button block class="login-button" (click)="LoginUser()">Login</button>
</ion-item>
Or you can override ion-item style and change or remove padding like below
default padding : padding-left: 16px;
ion-item {
background-color:transparent !important;
padding-left: 0px;
}
By doing this you can find your ion-input same like login button.
Hope this will helps!
Related
I am trying to show the button on the bottom of page but the issue is its not showing in bottom just showing on the middle not in end.
Here is my .html code
<ion-header no-border>
<ion-toolbar >
<ion-buttons slot="start" style="margin:5px 0px 5px 5px;">
<img src="assets/icon/favicon.png" height="50px">
</ion-buttons>
<ion-buttons slot="end">
<ion-button (click)="skip()"><p>SKIP</p></ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<div>
<ion-slides pager="true" #mySlider>
<!-- Slide 1 -->
<ion-slide>
<div>
<img src="assets/welcome-slides/portrait.png"/>
<h2>
Capture the moment
</h2>
<ion-label color="gray">
Our photographer will capture the shot in the right place.
</ion-label>
</div>
<ion-button expand="block" class="btn" (click)="swipeNext()">NEXT</ion-button>
</ion-slide>
</ion-slides>
</div>
</ion-content>
.scss
.toolbar-background {
border: none;
}
.btn{
width: 90%;
height: 50px;
position : absolute;
bottom : 0;
left: 5%;
}
ion-slide {
padding-top: 0px;
padding-left: 10px;
padding-right: 10px;
}
.bar-header {
background-color: red($color: #000000);
border: 0px !important;
border-bottom-color: transparent !important;
background-image: none !important;
border-bottom: none !important;
}
I try to set height of slide but dont know why its not working seems like button is in the end of slide but the height is less thats why button is showing in middle.
Try placing your button outside of the <ion-slides> component.
<ion-header no-border>
<ion-toolbar >
<ion-buttons slot="start" style="margin:5px 0px 5px 5px;">
<img src="assets/icon/favicon.png" height="50px">
</ion-buttons>
<ion-buttons slot="end">
<ion-button (click)="skip()"><p>SKIP</p></ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<div>
<ion-slides pager="true" #mySlider>
<!-- Slide 1 -->
<ion-slide>
<div>
<img src="assets/welcome-slides/portrait.png"/>
<h2>
Capture the moment
</h2>
<ion-label color="gray">
Our photographer will capture the shot in the right place.
</ion-label>
</div>
</ion-slide>
</ion-slides>
<!-- put your button here -->
<ion-button expand="block" class="btn" (click)="swipeNext()">NEXT</ion-button>
<!-- put your button here -->
</div>
</ion-content>
I am seeing some very odd behavior of my ion-input field when i click inside of it. I have pinpointed it (and not sure why) to the padding-top in the parent div. I also noticed that if I scale back the text to a few words in the p. Any thoughts as to why this is happening or how i can fix it?
.main
.main {
margin: 0 auto;
padding-left: 24px;
padding-right: 24px;
padding-top: 100px; // IF I REMOVE THIS, IT IS NORMAL
&.no-nav {
padding-top: 0px;
}
&.no-content {
:before {
content: '';
position: absolute;
height: 1px;
width: calc(100% - 48px);
border-bottom: 1px solid $surface-03;
top: 96px;
left: 24px;
}
}
&.top-nav {
padding-top: 24px;
}
}
template code
<ion-content>
<div class="main">
<ion-card>
<ion-card-content>
<p>a bunch of text here that seems to push the input box in click down, if i only put a few words here it doesn't behave like this which is odd</p>
<form [formGroup]="" novalidate>
<ion-item>
<ion-input
formControlName=""
required
inputmode="text"
placeholder="Click in me"
></ion-input>
<ion-icon class="edit-icon"></ion-icon>
</ion-item>
</form>
</ion-card-content>
</ion-card>
</div>
</ion-content>
Here is the behavior
I am tring to show my grid centered on screen but it showing on right side
Here is my code
<ion-content class="ion-padding">
<h3 style="margin-left: 15px;margin-top: 30px;">Home</h3>
<div>
<ion-grid style="height: 100%">
<ion-row class="ion-align-items-center ion-justify-content-center">
<ion-col size="6" *ngFor="let x of data">
<ion-card class="card-img" (click)="detail()">
<img src="../../assets/img/demo.jpg" style="height: 180px; width: 150px;">
<div style="text-align: center;" class="boxe">
<ion-icon name="checkmark" class="tick" color="medium"></ion-icon>
<ion-icon name="close" class="cross" color="dark"></ion-icon>
</div>
</ion-card>
</ion-col>
</ion-row>
</ion-grid>
</div>
</ion-content>
.scss
.card-img{
border-radius: 10px;
width: 150px;
}
.tick{
text-align:center;
font-size: 30px;
}
.cross{
text-align:center;
font-size: 30px;
}
As in image in need to centered the grid and remove top spaces between images
Try This : -
page.scss
.card-img{
border-radius: 10px;
img{
width: 100%;
}
}
I try this
<ion-item style="padding:0px !important;" >
or html
<ion-item class="no-padding" >
<ion-input [(ngModel)]="siparis.urun.stok_adi" type="text" ></ion-input>
</ion-item>
scss
.no-padding {
padding: 0px !important;
}
but didnt remove input padding
enter image description here
I've got buttons which are not clickable when within the ion-content. When I bring them out, they work just fine. Here's my HTML and SCSS. Very strange behavior, maybe I'm missing something?
<ion-content no-bounce>
<div class="content_cover_exit">
<button class="exit-button" (click)="logoutUser()">
<ion-icon name="ios-exit-outline" class="icon-exit-class"></ion-icon>
EXIT
</button>
</div>
</ion-content>
.content_cover_exit {
width: 100%;
text-align: center;
position: fixed;
bottom: 70px;
z-index: 9999;
margin-bottom: constant(safe-area-inset-bottom);
margin-bottom: env(safe-area-inset-bottom);
}
.exit-button {
height: 2.0em;
border-radius: 5px;
opacity: 100%;
background-color: white;
font-size: 0.8em;
font-weight: 400;
letter-spacing: 1.2px;
color: $dark-text;
z-index: 999999;
}
.exit-button.activated {
background-color: white;
}
.icon-exit-class {
color: $dark-text;
}
UPDATE:
Further research showed that even *ngIf doesn't work! this is begging to look super strange!
just add ion-button directive to you button tag and it will work fine.
ionic adds some enhanced with an ion-button directive.
<ion-content no-bounce>
<div class="content_cover_exit">
<button ion-button class="exit-button" (click)="logoutUser()">
<ion-icon name="ios-exit-outline" class="icon-exit-class"></ion-icon>
EXIT
</button>
</div>
</ion-content>
try like this
<ion-content no-bounce>
<div class="content_cover_exit">
<button class="exit-button"(click)="exitApp()">
<ion-icon name="ios-exit-outline" class="icon-exit-class"></ion-icon>
EXIT
<button>
</div>
</ion-content>
and your
.ts
import {Platform} from 'ionic-angular';
export MyPage {
constructor(platform: Platform) {
this.platform = platform;
}
exitApp(){
this.platform.exitApp();
}
}