mercredi 25 avril 2018

Web page layout appearing differently on different screens

I know this type of question has been asked before but I am unable to find the solution for myself, Please help me.

I have designed my web page,

HTML code,

<div class="firstDiv"></div>
<div class="secondDiv"></div>
<div class="loginDiv">
  <form>
      <div class="row center">
          <i class="fa fa-user-circle"></i>
      </div>

    <div class="container">
    <input type="text" placeholder="Username" name="uname" required>

    <input type="password" placeholder="Password" name="psw" required>
      <br/>
      <br/>
    <button mat-button (click)="submit()">Login</button>
    <br/>
    <label>
      <input type="checkbox" checked="checked" name="remember"> Remember me
    </label>

    </div>
  </form>
</div>

CSS code,

@import '~@angular/material/theming';
@include mat-core();

$yaana-app-primary: mat-palette($mat-orange, 800,400,200);

.firstDiv {
    height: 40%;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    position: absolute;
    background-color: orangered;
    display: inline-block;
}

.secondDiv {
    position: absolute;
    width: 100%;
    bottom: 0;
    height: 60%;
    left: 0;
    right: 0;
    background-color:whitesmoke;
    display: inline-block;
}

.loginDiv {
    border: 1px solid black;
    background: white;
    left: 50%;
    position: absolute;
    top: 28%;
    transform: translate(-50%);
    background-color: #fff;
    padding: 15px;
    box-shadow:1px 3px 10px rgba(0, 0, 0, 0.34);
}
input[type=text], input[type=password] {
    width: 100%;
    padding: 12px 20px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid #ccc;
    box-sizing: border-box;
}
button {
    width: 60%;
    height: 20%;
    line-height: 36px;
    background: transparent;
    border-radius: 3px;
    will-change: transform;
    -webkit-transition: all .2s ease;
    transition: all .2s ease;
    border: none;
    /*border: 2px solid #FF5126;*/
    cursor: pointer;
    background: #F26722;
    font-size: 16px;
    color: #fff;
    outline: none;
    text-align: center;
    padding: 0 6px;
    margin: 6px 8px;
    display: block;
    margin: auto;
    font-size: 14px;
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
    text-transform: uppercase !important;
}

button:hover {
    opacity: 0.8;
}
.loginImgContainer {
    display: table;
    max-height: 40px;
    max-width: 40px;
}

i.fa {
    background: #fff;
    display: inline-block;
    font-size: 80px;
    transform: translateY(-60%);
    transform: translateX(160%);
    border-radius: 50%;
    margin: auto;
    position: relative;
    }

And when I run the web page I am getting different views,

1) For Desktop Browser

enter image description here

2) For small screens such as IPhone 6

enter image description here

3) For Ipad Pro,

enter image description here

I wanted the user icon to appear at centre but it is getting deviated from centre based on screen sizes.

How to fix this problem, Please help me.




Aucun commentaire:

Enregistrer un commentaire