CSS issues in IE - html

I have design a login form using html and css. The styles are displayed correctly in chrome and firefox. But in IE it has some problems.
HTML
<div id="wrapper">
<div id="page">
<form id="adminLoginForm">
<label>User Name :</label>
<input type="text" class="uname"/>
<label>Password :</label>
<input type="password" class="pwd"/>
<input type="submit" class="loginSubmit submit" value="SUBMIT"/>
<p class="alert loginAlert">Test alert</p>
</form>
</div>
</div>
CSS
#wrapper{
width:1000px;
margin:0 auto;
}
p{
margin:0;
padding:0;
}
#page{
float: left;
width: 1000px;
min-height: 480px;
background-color: #FFFFFF;
padding-bottom:20px;
}
.submit{
float:left;
width: 130px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: bold;
cursor: pointer;
height:30px;
background: url('/img/bg/submit.jpg');
border: none;
border-radius: 10px;
color: #960000;
}
.alert{
float: left;
width: 100%;
margin-top: 5px;
color: #C00;
display:none;
}
#adminLoginForm{
float: left;
width: 350px;
height: 170px;
margin-left: 325px;
margin-top: 150px;
background: url('/img/bg/b15.jpg');
border-radius: 10px;
box-shadow: 0px 0px 10px #A38D77;
padding-top: 10px;
}
#adminLoginForm label{
float: left;
width: 150px;
text-align: right;
font-weight: bold;
color: #000000;
font-size: 15px;
margin-top: 20px;
}
#adminLoginForm input{
float: left;
width: 150px;
margin-top: 19px;
margin-left: 5px;
padding-left: 5px;
padding-right: 5px;
}
#adminLoginForm input.loginSubmit{
width:130px;
margin-left:111px;
}
Output in Chrome & Firefox
Output in IE
I know the border-radius and box-shadow not works in IE. But I don't know why the gap between the label and text-boxes in IE. Can anybody help me to resolve this..?

If you wrap the contents of the form in a div that then becomes the only child of the form, the issue is fixed:
HTML:
<form id="adminLoginForm">
<div>
<label>User Name :</label>
<input type="text" class="uname"/>
<label>Password :</label>
<input type="password" class="pwd"/>
<input type="submit" class="loginSubmit submit" value="SUBMIT"/>
<p class="alert loginAlert">Test alert</p>
</div>
</form>
I thought of this because I recall (back in the days when it seemed XHTML would become the new web standard) that, with XHTML, native inline elements (like <label> and <input>) are not valid children of the <form> element.
I don't think that's the case with regular HTML, but the point is that the <form> tag and the various <input>elements are rather special, and tend to follow their own CSS formatting rules.

try to use table pattern for these type of designs..best compatibility trick for all browsers..
<div id="wrapper">
<div id="page">
<form id="adminLoginForm">
<table>
<tr><td><label>User Name :</label></td><td><input type="text" class="uname"/></td></tr>
<tr><td><label>Password :</label></td><td><input type="password" class="pwd"/></td></tr>
<tr><td colspan="2" style="text-align:center;"><input type="submit" class="loginSubmit submit" value="SUBMIT"/></td></tr>
</table>
<p class="alert loginAlert">Test alert</p>
</form>
</div>
</div>

Related

stack vertically inline input text html

These input text are already stacked vertically but they're not in-line along with the other text. Image:[1]: https://i.stack.imgur.com/UicEL.png
#advanced input[type="text"] {
border-radius: 0px;
-moz-border-radius:0px;
-webkit-border-radius:0px;
width: 300px;
height: 15px;
padding: 5px 10px;
background-image: none;
font-size: 20px;
display: block;
margin-left: 30%;
}
<form action="https://google.com/search">
<div id="advanced">
Find pages with...<br/><br/>
all these words:<input type="text" name="as_q">
this exact word or phrase:<input type="text" name="as_epq">
any of these words:<input type="text" name="as_oq">
none of these words:<input type="text" name="as_eq">
</div>
<input type="submit" value="Advanced Search">
</form>
What made it stack vertically was exactly the code:
display: block;
margin-left: 30%;
This looks to have been answered previously HERE - something like this might work for you, adding display:grid to the parent element.
#advanced input[type="text"] {
border-radius: 0px;
-moz-border-radius:0px;
-webkit-border-radius:0px;
width: 300px;
height: 15px;
padding: 5px 10px;
background-image: none;
font-size: 20px;
margin-left: 30%;
vertical-align:top;
}
#advanced {
display:grid;
grid-template-columns: max-content max-content;
grid-gap:10px;
}
#advanced.settings label { text-align:left; }
#advanced.settings label:after { content: ":"; }
<form action="https://google.com/search">
Find pages with...<br/><br/>
<div id="advanced">
all these words:<input type="text" name="as_q">
this exact word or phrase:<input type="text" name="as_epq">
any of these words:<input type="text" name="as_oq">
none of these words:<input type="text" name="as_eq">
</div>
<input type="submit" value="Advanced Search">
</form>

how to align input text to right

I'm trying to do a google advanced search. I'm having trouble with the input text, I want to align them right just like Google, at a close distance and all accordingly.
This is my html:
<form action="https://www.google.com/advanced">
<div id="advanced">
Find pages with...<br/><br/>
all these words:<input type="text" name="words"><br/><br/>
this exact word or phrase:<input type="text" name="exact"><br/><br/>
any of these words:<input type="text" name="any"><br/></br>
none of these words:<input type="text" name="none"><br/><br/>
</div>
<input type="submit" value="Advanced Search">
</form>
This is my css:
#advanced input[type="text"] {
border-radius: 0px;
-moz-border-radius:0px;
-webkit-border-radius:0px;
width: 300px;
height: 15px;
padding: 5px 10px;
background-image: none;
font-size: 20px;
display: block;
float: right;
}
But that makes them go to the right... Way too much. I wish I could adjust it. This is how it looks like.
[1]: https://i.stack.imgur.com/zX83k.png
Any help is appreciated, thank you.
You can simply apply a width or max-width to the container (#advanced) in your current code:
#advanced {
width: 100%;
max-width: 520px;
}
#advanced input[type="text"] {
border-radius: 0px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
width: 300px;
height: 15px;
padding: 5px 10px;
background-image: none;
font-size: 20px;
display: block;
float: right;
}
<form action="https://www.google.com/advanced">
<div id="advanced">
Find pages with...<br/><br/> all these words:<input type="text" name="words"><br/><br/> this exact word or phrase:<input type="text" name="exact"><br/><br/> any of these words:<input type="text" name="any"><br/></br>
none of these words:<input type="text" name="none"><br/><br/>
</div>
<input type="submit" value="Advanced Search">
</form>
use flexbox
#advanced {
flex: 1;
flex-direction: column;
}
and remove
display: block;
float: right;
and remove the BR's

Why does the writable part of the form start from the middle?

Basically I tried to make a form for the first time, but I can't manage to understand why the writable area doesn't start from the beginning. I think it might have something to do with the padding, but I'm not sure. I know that the answer will probably be obvious, but I'm pretty new to this enviroment and to be honest I can't figure it out. Obviously there isn't all of the code of the website, I just posted the interested part.Thank you in advance.
label{
font-size: 30px;
font-family: 'Raleway', sans-serif;
margin-left: -390px;
margin-right: 100px;
display: block;
margin-top: 70px;
}
input[type=text],
input[type=email],
textarea{
padding: 12px 200px;
box-sizing: border-box;
background-color: #222326;
border: none;
border-bottom: 1px solid #D9D9D9;
text-align: left;
}
.msg-label{
margin-left: -345px;
}
.email-label{
margin-left: -398px;
}
textarea{
margin-bottom: 100px;
padding-right: 300px 220px;
overflow:hidden;
margin-right: -50px;
}
<div id="contact-me">
<div id="center">
<h2>CONTACT ME</h2>
</div>
<div id="center">
<form action="action-page.php">
<label for="name" class="name-label">Name</label>
<input type="text" id="name" name="full-name" >
<label for="email" class="email-label">Email</label>
<input type="email" id="email" name="email">
<label for="message" class="msg-label">Message</label>
<textarea id="msg" name="message"></textarea>
<input type="submit" value="Submit">
</form>
</div>
</div>
input[type=text],
input[type=email],
textarea{
padding: 12px 200px;
box-sizing: border-box;
background-color: #222326;
border: none;
border-bottom: 1px solid #D9D9D9;
text-align: left;
}
its the padding that you have added in the snippet above. padding adds space within the element as such you are pushing everything inside.

CSS Contact Form not being responsive

I have created a Contact Form, everything looks somewhat fine, the way I want it but having issues. The Form is not being responsive when re-sizing/scale the browser down. I have messed around, I think a little too much with the code to the point that I have no clue what i'm doing or have done. I'm about to lose my mind!
When I re-size the browser, the labels go outside of the container it's in. The submit button is also not centering even when I try margin: 0 auto;
I will post the HTML & CSS along with my CodePen below. Thanks for any help!
CodePen https://codepen.io/vCoCo/pen/MLReKK?editors=1100
HTML
<section id="contact">
<div class="container">
<form id="contactForm" action="contactform.php" method="post">
<h2> Get In Touch! </h2>
<div class="details">
<label for="firstName"> First Name </label>
<input type="text" id="firstName" name="firstName" placeholder="Enter First Name..." required>
</div>
<div class="details">
<label for="lastName"> Last Name </label>
<input type="text" id="lastName" name="lastName" placeholder="Enter Last Name..." required>
</div>
<div class="details">
<label for="email"> Email </label>
<input type="email" id="email" name="email" placeholder="Enter Email..." required>
</div>
<div class="details">
<label for="textMessage"> Message </label>
<textarea id="textMessage" name="textMessage" placeholder="Enter Message In Here..." required></textarea>
</div>
<input type="submit" value="Submit Message">
</form>
</div>
</section>
CSS
body{
background-color: grey;
}
/**** GLOBAL ****/
.container{
max-width: 80%;
margin: auto;
overflow: hidden;
border: 2px solid white;
}
/********** CONTACT FORM **********/
#contact{
max-width: 80%;
margin: 100px auto;
border: 1px dashed orange;
}
#contact .container{
width: 500px;
margin: 100px auto;
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
#contactForm{
margin: 0 auto;
}
#contactForm h2{
text-align: center;
margin-bottom: 10px;
}
.details{
max-width: 500px;
margin: 15px;
padding: 10px;
border: solid 1px #ff0000;
overflow: hidden;
}
label{
margin-bottom: 10px;
}
input[type=text], input[type=email]{
width: 400px;
padding: 12px 20px;
margin: 8px 0;
border: 2px solid;
border-radius: 4px;
}
input[type=submit]{
width: 200px;
padding: 10px 20px;
color: #fff;
background-color: #000;
border: 2px solid #fff;
border-radius: 10px;
font-family: inherit;
cursor: pointer;
}
textarea{
width: 300px;
height: 200px;
resize: none;
font-size: 16px;
}
#contactForm textarea::placeholder{
font-size: 16px;
}
You have a problem with the width of several elements, you're setting fixed widths and it repercusses on mobile resolutions, also with the overflow of the container it make the childs to hide inside the parent.
A good solution for a responsive mode is to set the widths to 100% of the parent and setting a max width for greater resolutions.
I made a fork of your Codepen.
Important: most of the problem also is, make sure to set the box-sizing of global elements. i.e. * { box-sizing: border-box;}
Hope this helps.
Codepen https://codepen.io/devlumberjack/pen/rPbMzr?editors=1100

Space between fieldsets how to remove it

I have created a simple login form. Here is a screenshot of the login form.
Here is the HTML code. I have used the 960 framework.
<article class="container_12">
<section id="login" class="grid_3">
<form action="POST">
<div id="loginheader"></div>
<fieldset class="logininputfields">
<input type="text" name="username" placeholder="Username" autofocus>
<input type="password" name="password" placeholder="Password">
</fieldset>
<fieldset class="submitfield">
<input type="submit" value="Log In">
</fieldset>
</form>
</section>
</article>
and here is the CSS
#login
{
height: 330px;
}
#loginheader
{
background: black;
height: 32px;
}
.logininputfields
{
background-color: #e5e5e5;
padding-left: 24px;
padding-bottom: 40px;
height: 160px;
}
.logininputfields input[type="text"],input[type="password"]
{
background: #c8cbcc;
margin-top: 30px;
border:1px solid #ccc;
color: #ededed;
font-weight: 600;
height: 30px;
width: 170px;
}
.submitfield input[type="submit"]
{
background: #0099ff;
border: 1px solid #ccc;
height: 42px;
width: 220px;
font-weight: 600;
font-size: large;
color: white;
}
.submitfield input[type="submit"]:hover
{
background: rgba(0,154,255,0.60);
}
I don't understand why there is a space between the submit button and the gray area. How can avoid it?
The browser you're viewing this in likely has default margins on all fieldsets. Try removing those margins page wide with something like this:
fieldset {
margin:0px;
padding:0px;
}
In my case, the above solution din't work. I have added a blank <Col></Col> in order to get space between the fieldsets.