I am using email input field, for forgot password password. But on Firefox it is not showing properly.
I am using below code
<div class="mainB">
<div class="centerBlock">
<form method="post">
<div class="alignText">
Enter Email Address:
<input type="email" name="userEmail" required="required"
pattern="[a-zA-Z]{3,}@[a-zA-Z]{3,}[.]{1}[a-zA-Z]{2,}[.]{1}[a-zA-Z]{2,}"
maxlength="45" id="forgotPassTextField" />
<br>
<br>
</div>
<div id="alignCenter">
<button class="btn mt-15 btn-default btn-custom" type="submit">
Ok
</button>
<button class="btn mt-15 btn-default btn-custom" type="button"
onclick="">
Cancel
</button>
</div>
</form>
The suggestions are showing at the bottom of the page and text field is at the top of page:
MY CSS as follows:
.alignText {
margin-left: 52px;
text-align: left;
}
#forgotPassTextField {
width: 252px;
}
#alignCenter {
text-align: center;
}
.mainB {
height: 585px;
position: absolute;
width: 100%;
}
.centerBlock {
background-color: #FFFFFF;
box-shadow: 1px 1px 10px #000000;
height: 230px;
margin: 0 auto;
position: relative;
top: 50%;
transform: translateY(-50%);
vertical-align: middle;
width: 500px;
}
The problem with the “suggestions” box (the box that appears suggesting some previously entered value when you type something that matches the start of such a value) is that it is under the control of the browser. There is no specification on it and not much public documentation either.
In this case, that box is displayed because the input
element is inside an element (the div
with class centerBlock
) on which a CSS transformation is applied, namely a simple translation in the y direction. It seems that Firefox gets confused and thinks that the input
element is placed in a location where it would be without the transformation.
Thus, the fix is to remove transform: translateY(-50%);
. For positioning the element, it is better to place it at the right place otherwise. In this case, it is relatively positioned, so you would just need to replace top: 50%;
by top: calc(50% - 115px);
. The value 115px
is 50% of the height of the div
element.
The calc
construct is not supported by IE 8 or earlier, but neither is transform
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments