mohammed mohammed - 4 months ago 8
CSS Question

CSS-styling on my form doesn't work on Firefox

I have this login form, which works and looks just fine in Chrome, IE11 and Edge but when try it out on Firefox, it looks completely different;

My labels are not the same width, so I have to re-adjust them. Also, my submit button doesn't seem to take on styles.

How can I make this work with Firefox as well?

My HTML:

<div class="loginheader">تسجيل الدخول</div>

<div class="loginform">
<form action="login.php" method="post" name="myform" id="myform">
<p>
<label for="loginform">اسم المستخدم</label>
<input type="text" name="username" id="login" value="mohammed.nasyia@gmail.com" placeholder="اسم المستخدم" />
</p>

<p>
<label for="loginform">كلمة المرور</label>
<input type="password" name="password" id="password" value="mohammed.nasyia@gmail.com" placeholder="كلمة المرور" />
</p>

<p >
<input type="submit" name="submit" value="تسجيل الدخول" class="button admin-login-button"/>
</p>


</form>

</div>
<div class="loginfooter">

<a href="#" class="examinee"> تسجيل الدخول كممتحن </a>



</div>


</div>


CSS:

.login-container {
margin-top: 100px;
margin-bottom: 50px;
margin-left: auto;
margin-right: auto;
width: 600px;
}
.loginform {
direction:RTL;
padding: 55px;
background-color: #fff;
border: 1px solid #eee;
border-bottom: 0px;
border-top: 0px;
}
.loginheader {
text-align: center;
background-color: #f5f5f5;
padding: 15px 0px;
border-radius: 10px 10px 0 0;
font-size: 30px;
}
.loginfooter {
padding: 15px 40px;
background-color: #f5f5f5;
border-radius: 0px 0px 10px 10px;
font-size: 18px;
text-align: center;
}
.loginheader, .loginfooter {
background-color: #f5f5f5;
border: 1px solid #ededed;
}

a {
text-decoration: none;
color: #000;
}

input[type=text], input[type=password] {
padding: 0 10px;
width: 320px;
height: 38px;
font-size: 16px;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
}
label {
float: rihgt;
width: 100px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.edit-examinee label{
float: rihgt;
width: 130px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.loginform label {
float: rihgt;
width: 100px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.button {
display: inline-block;
zoom: 1;
padding: 12px 30px;
margin: 0;
cursor: pointer;
border: 1px solid #bbb;
overflow: visible;
font: bold 16px arial, helvetica, sans-serif;
text-decoration: none;
white-space: nowrap;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.admin-login-button {
margin-right: 350px;
color: #333;
background-color: #fff;
border-color: #ccc;
}
.admin-login-button:hover {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.admin-login-button:active {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
position: relative;
top: 2px;
text-shadow: none;
box-shadow: 0 1px 1px rgba(0, 0, 0, .3) inset;
}


You can also check the JSFiddle of the form.

Answer

I removed the floats (with a typo), set the margin to left on the .admin-login-button. I also added a media query for smaller screens.

https://jsfiddle.net/6p4v9hs6/7/

New CSS here:

.login-container {
    margin-top: 100px;
    margin-bottom: 50px;
    margin-left: auto;
    margin-right: auto;
    width: 600px;
}
.loginform {
direction:RTL;
    padding: 55px;
    background-color: #fff;
    border: 1px solid #eee;
    border-bottom: 0px;
    border-top: 0px;
}
.loginheader {
    text-align: center;
    background-color: #f5f5f5;
    padding: 15px 0px;
    border-radius: 10px 10px 0 0;
    font-size: 30px;
}
.loginfooter {
    padding: 15px 40px;
    background-color: #f5f5f5;
    border-radius: 0px 0px 10px 10px;
    font-size: 18px;
    text-align: center;
}
.loginheader, .loginfooter {
    background-color: #f5f5f5;
    border: 1px solid #ededed;
}

a {
    text-decoration: none;
    color: #000;
}

input[type=text], input[type=password] {
    padding: 0 10px;
    width: 320px;
    height: 38px;
    font-size: 16px;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
}
label {
    /* float: rihgt; */
    width: 100px;
    line-height: 40px;
    padding-left: 10px;
    font-size: 18px;
    text-align: left;
    display: inline-block;
    margin: 10px 0px;
}
.edit-examinee label{
    /* float: rihgt; */
    width: 130px;
    line-height: 40px;
    padding-left: 10px;
    font-size: 18px;
    text-align: left;
    display: inline-block;
    margin: 10px 0px;
}
.loginform label {
    /* float: rihgt; */
    width: 100px;
    line-height: 40px;
    padding-left: 10px;
    font-size: 18px;
    text-align: left;
    display: inline-block;
    margin: 10px 0px;
}
.button {
    display: inline-block;
    zoom: 1;
    padding: 12px 30px;
    margin: 0;
    cursor: pointer;
    border: 1px solid #bbb;
    overflow: visible;
    font: bold 16px arial, helvetica, sans-serif;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 4px;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
}
.admin-login-button {
    margin-left: 350px;
    color: #333;
    background-color: #fff;
    border-color: #ccc;
}
.admin-login-button:hover {
    color: #333;
    background-color: #e6e6e6;
    border-color: #adadad;
}
.admin-login-button:active {
    color: #333;
    background-color: #e6e6e6;
    border-color: #adadad;
    position: relative;
    top: 2px;
    text-shadow: none;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .3) inset;
}
@media screen and (max-width: 540px) {
    input[type=text], input[type=password] {
        width: 90%;
    }
}

Seems to work in both Safari and Firefox.

Comments