Form Problem in ONLY IE6 and IE7 - html

For some reason the form inputs are pushing off the left margin.. I have no clue why!
Below is the link..
http://mimedx.com/mg/contactus.php
I have no clue why this is happening. Probably Microsoft being Microsoft and having some random rule that conflicts with standards..
CSS:
#content form { overflow: hidden; width: 550px; }
#content form ul { padding: 0; }
#content form li { list-style: none; float: left; width: 250px; padding: 4px 0; }
#content form label { display: block; width: 100px; line-height: 15px; font-size: 1em; padding-bottom: 2px; font-weight: bold;}
#content form input { display: block; width: 200px; padding: 4px; margin: 0; line-height: 14px; font-size: .9em; background-color: #f7f7f7; border: 1px solid #d4d4d4; color: #4d4d4d; }
HTML:
<form action="/mail.php" method="post" name="contactForm" id="contactForm">
<ul>
<li>
<label for="first_name">First Name</label>
<input type="text" name="first_name" id="first_name" />
</li>
<li>
<label for="last_name">Last Name</label>
<input type="text" name="last_name" id="last_name" />
</li>
<li>
<label for="phone">Phone</label>
<input type="text" name="phone" id="phone" />
</li>
<li>
<label for="email">Email</label>
<input type="text" name="email" id="email" />
</li>
<li class="full">
<label for="comments">Comments</label>
<textarea name="comments" id="comments"></textarea>
</li>
<li>
<input type="submit" name="submit" id="submit" value="Submit" />
</li>
</ul>
</form>

The list elements are responsible, quite a common problem in IE.
Try setting
#content form ul { margin: 0; }
#content form li { margin: 0; }
More generally, you might find using a reset css useful. This removes browser specific styling and gives you a 'blank canvas' to work from. I always use the YUI Reset but there are plenty of options out there.

Related

HTML/CSS sign up form

I am currently working on creating a sign up form html/css. I realised that different browsers work differently on the width of inputs. How can i rectify this issue and make sure that my sign up form is compatible with all browsers. My sign up form works perfectly for chrome as it is where i do coding on.
ul {
background-color: #000000;
}
li a:hover {
background-color: #0cf72a;
}
.word-container {
width: 500px;
height: 50px;
margin: auto;
position: relative;
top: 80px;
}
.word-container h1 {
margin: 0;
text-align: center;
color: #ab0a0a;
}
.register-container {
width: 600px;
height: 350px;
margin: auto;
position: relative;
top: 100px;
border: 1px solid #000;
}
.fname input[type="text"] {
position: relative;
left: 115px;
top: 30px;
padding: 8px;
}
.lname input[type="text"] {
position: relative;
left: 314px;
top: -5.5px;
padding: 8px;
}
.userid input[type="text"] {
position: relative;
left: 115px;
padding: 8px;
top: 10px;
}
.pwd input[type="password"] {
position: relative;
padding: 8px;
left: 115px;
top: 25px;
}
.email input[type="email"] {
position: relative;
padding: 8px;
left: 115px;
top: 40px;
}
.btn button[type="submit"] {
position: relative;
left: 115px;
top: 55px;
padding: 8px;
width: 382px;
border: 1px solid #000000;
color: #ffffff;
background-color: #ab0a0a;
}
div.btn button[type="submit"]:hover {
background-color: rgb(255, 0, 0);
}
<div class="word-container">
<h1>Create your account</h1>
</div>
<div class="register-container">
<form action="" method="POST">
<div class="fname">
<label>
<input type="text" placeholder="First Name" name="fname" size="20">
</label>
</div>
<div class="lname">
<label>
<input type="text" placeholder="Last Name" name="lname" size="20">
</label>
</div>
<div class="userid">
<label>
<input type="text" placeholder="Username" name="userid" size="50">
</label>
</div>
<div class="pwd">
<label>
<input type="password" placeholder="Password" name="pwd" size="50">
</label>
</div>
<div class="email">
<label>
<input type="email" placeholder="Email Address" name="email" size="50">
</label>
</div>
<div class="btn">
<button type="submit">Create Account</button>
</div>
</form>
</div>
It's always a good idea to use something like normalize.css or any other CSS reset code (eric meyer css reset is very popular too) to reset CSS across all browsers.
Any browser come with it's defaults values for padding's,margins,widths, heights etc...
I guess it won't be an 100% solution but it will defiantly will take you closer to what you're looking for.
Do not jump to position relative and absolute. If you are new to all this, I can understand it seems the most natural way to go about positioning elements; just using a top and left position and that's that. But this is not how you should do it on the web!
Below you can find how I would do it.
Matan G. is right in pointing out that a CSS reset/normalize is often used, and I do so myself as well. However, before you do that (and considering you're new) it would be wise to take a look at the code that I posted and see if it makes any sense to you. If not, ask.
It is important to note that you should avoid these things when possible:
setting a fixed width to text items such as headings, paragraphs, lists.
using relative/absolute positioning. They are very useful but only when necessary.
using too many divs/classes than actually needed. Don't overcrowd your HTML.
* {box-sizing: border-box;}
ul {
background-color: #000000;
}
li a:hover {
background-color: #0cf72a;
}
.word-container {
width: 500px;
height: 50px;
margin: 80px auto auto;
}
.word-container h1 {
margin: 0;
text-align: center;
color: #ab0a0a;
}
.register-container {
width: 600px;
margin: 20px auto auto;
border: 1px solid #000;
padding: 20px;
}
label {
display: block;
}
.name::after {
content: "";
display: table;
clear: both;
}
.name label:first-child {
margin-right: 20px;
}
.name label {
width: calc(100% / 2 - 10px);
float: left;
}
input, [type="submit"] {
padding: 8px;
margin-bottom: 20px;
width: 100%;
}
[type="submit"] {
border: 1px solid #000000;
color: #ffffff;
background-color: #ab0a0a;
margin: 0;
}
[type="submit"]:hover {
background-color: red;
}
<div class="word-container">
<h1>Create your account</h1>
</div>
<div class="register-container">
<form action="" method="POST">
<div class="name">
<label>
<input type="text" placeholder="First Name" name="fname">
</label>
<label>
<input type="text" placeholder="Last Name" name="lname">
</label>
</div>
<label>
<input type="text" placeholder="Username" name="userid">
</label>
<label>
<input type="password" placeholder="Password" name="pwd">
</label>
<label>
<input type="email" placeholder="Email Address" name="email">
</label>
<button type="submit">Create Account</button>
</form>
</div>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Forms</title>
<style>
.container{
width: 45%;
margin: auto;
}
.form-content{
margin: 40px;
}
.form-content input{
width: 100%;
}
label{
font-weight: bold;
}
input[type=text],[type=email],[type=tel],[type=date],[type=password]{
font-size: 16px;
border-radius: 5px;
background: #D9F1F7;
border: #000000;
padding: 10px;
}
input[type=submit]{
background: #4C63ED;
padding: 10px;
border: none;
border-radius: 5px;
font-size: 16px;
color: #fff;
cursor: pointer;
}
input[type=submit]:hover{
background: #330EEF;
font-weight: bold;
}
</style>
</head>
<body>
<div class = "container">
<form name="signup" method="get" action="">
<div class="form-content">
<label>First Name : </label>
<input type="text" name="firstname" />
</div>
<div class="form-content">
<label>Last Name : </label>
<input type="text" name="lastname" />
</div>
<div class="form-content">
<label>E-Mail : </label>
<input type="email" name="email" />
</div>
<div class="form-content">
<label>Telephone : </label>
<input type="tel" name="telephone" />
</div>
<div class="form-content">
<label>Date of Birth : </label>
<input type="date" name="dob" />
</div>
<div class="form-content">
<input type="submit" name="submit" value="Submit" />
</div>
</form>
</div>
</body>
</html>

Radio buttons display incorrectly on iPad

A couple of radio buttons display all messed up on iPad (Safari) running latest IOS 8....
This is how the buttons look in all other browsers (PCs and Android phones):
http://dotwdesign.com/right/right.png
This is how it displays on the iPad (see buttons on the left, misplaced and squared):
http://dotwdesign.com/wrong/wrong.jpg
Here is my HTML (the two containing divs are because I have some additional unrelated code embedded [hidden here] - pls don't pay attention to that:))
<div id= "contactform">
<div id="theform">
<form method="post" action="php/webmailer.php" name="form" id="message_form">
<ol>
<li>
<label for="full_name">First Name</label>
<input type="text" name="fname" />
</li>
<li>
<label for="lname">Last Name</label>
<input type="text" name="lname" />
</li>
<li>
<label for="email">Email</label>
<input type="text" name="email" />
</li>
<li>
<label for="phone">Phone</label>
<input type="text" name="phone" />
</li>
<li>
<label for="method">Preferred contact method</label>
<label for="Email">
<input type="radio" name="method" value="Email" checked />
Email</label>
<label for="Phone">
<input type="radio" name="method" value="Phone" />
Phone</label><br>
</li>
<li>
<label for="comments">Your Message</label>
<textarea name="message"></textarea>
</li>
<input type="submit" name="submit" value="Submit" />
</form>
</ol>
</div><!--end of theform div-->
</div><!--end of contactform div-->
And this is my CSS...
#contactform {
position: relative;
float: left;
margin: 50px 0 50px 80px;
width: auto;
}
#contactform ol li {
list-style-type:none;
}
#contactform input{
display:block;
width:300px;
margin-left: 0;
border:1px #000 solid;
border-radius: 3px;
padding: 5px;
}
#contactform textarea{
height:150px;
display:block;
width:300px;
margin-top: 3px;
border:1px #000 solid;
border-radius: 3px;
padding: 5px;
}
#contactform input:hover, textarea:hover {
background-color:#E0E0E0;
}
#contactform input:focus, textarea:focus{
background-color:#E0E0E0;
}
#contactform label{
display:block;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
margin-top:10px;
font-size: 14px;
font-style: italic;
font-weight: bold;
width: 330px;
}
#contactform input[type="radio"]{
display: inline-block !important;
margin-top: 5px !important;
margin-left: -90px !important;
margin-right: -80px !important;
width: 200px !important;
}
#contactform input[type="submit"] {
margin: 30px 0 0 120px;
width: 70px;
font-size: 15.5px;
}
#contactform input[type="submit"]:hover{
cursor: pointer;
cursor: hand;
}
#theform{
float: left;
border-radius: 6px;
background-color: #558ED5;
padding: 25px 0;
width:400px;
box-shadow: 10px 10px 3px rgba(12, 3, 25, 0.8);
}
After some online research I came across of a -webkit-appearance option that allows you to retain your native UI settings on Safari but it did not work (I tried options such as .... -webkit-appearance: default-button or -webkit-appearance: radio). ALSO tried adding onclick="" to my HTML labels and inputs as per another thread on this site. Still no luck.
It would be highly appreciated if someone can provide some guidance on how to fix this issue. Some other threads on this site address this issue but under a scripting approach (as opposed to a CSS one)
The positioning first gets changed because of the width: 300px; you have for all inputs. So instead of adding a new magic number for the radio buttons you can set it back to auto. Also the style for the radio buttons is more specific than the general input one so you don't need the !important. So this should work:
#contactform input[type="radio"] {
display: inline-block;
margin-top: 5px;
width: auto;
}
And if you want some more space between radio buttons and text again you can of course add it back with something like this: margin-right: 10px;

When I call another HTML page in a blank <div> it is shown in a small window instead of the full page

I have the home.html page where I have a menu. On clicking the link I want the addnew.html page to load into the part of the code. I get the page but it is shown in an small section.....
Home.html
<!DOCTYPE html>
<head>
<title>Contact Manager</title>
<link rel="stylesheet" type="text/css" href="Style1.css" />
<script>
function Load_addnew()
{
document.getElementById("load_here").innerHTML='<object type="text/html" data="Addnew.html"></object>'
}
</script>
</head>
<body>
<div id="main">
<div id="logo">
<h1><center>Contact Manager</center></h1>
</div>
<div id="menu">
<ul>
<li>ADD NEW CONTACT</li>
<li>EDIT A CONTACT</li>
<li>DELETE CONTACT</li>
<li>SEARCH CONTACTS</li>
<li>LIST OF CONTACTS</li>
</div>
<div id="load_here"></div>
</div>
</body>
</html>
Style1.css
#main
{
background-repeat: repeat;
}
#logo a, #menu a
{
text-decoration: none;
}
#menu ul
{
line-height: 1.5em;
font-size: x-large;
float: left;
list-style: none;
}
#load_here
{
}
#logo
{
background-color:
}
#menu
{
margin: 0px auto;
left: 0px;
right: 0px;
}
AddNew.html
<!DOCTYPE HTML>
<html>
<head>
<title>Add Contact</title>
<link rel="stylesheet" type="text/css" href="addnew.css"></link>
</head>
<body>
<div id="main">
<ul id="errors">
<li id="info">Please recheck your form and Submit again: </li>
</ul>
<p id="success">Details Saved Successfully!!</p>
<div id="form1">
<form action="" method="" id="add_new">
<label for="Fname">First Name <span class="required">*</span>:</label>
<input type="text" id="First_Name" name="FirstName" value="" pattern="[A-Z a-z]" required="required" autofocus="autofocus"/>
<label for="Mname">Middle Name :</label>
<input type="text" id="Middle_Name" name="MiddleName" pattern="[A-Z a-z]" value=""/>
<label for="Lname">Last Name <span class="required">*</span>:</label>
<input type="text" id="Last_Name" name="LastName" value="" pattern="[A-Z a-z]" required="required"/>
<label for="dob">Date of Birth <span class="required">*</span>:</label>
<input type="date" id="DOB" name="dob" value="" required="required"/>
<label for="Phone1">Phone 1 <span class="required">*</span>:</label>
<input type="text" id="contactHome" name="Phone1" value="" required="required"/>
<label for="Phone2">Phone 2:</label>
<input type="text" id="contactOffice" name="Phone2" value=""/>
<label for="email">Email <span class="required">*</span>:</label>
<input type="email" id="email" name="Email" value="" placeholder="username#example.com" required="required"/>
<label for="Address">Address Line 1 <span class="required">*</span>:</label>
<input type="text" id="address" name="Address" required="required"/>
<label for="Address">Address Line 2:</label>
<input type="text" id="address1" name="Address1"/>
<label for="city">City <span class="required">*</span>:</label>
<input id="city" name="City" required="required" value=""/>
<label for="state">State <span class="required">*</span>:</label>
<input id="state" name="State" required="required" value=""/>
<label for="country">Country<span class="required">*</span>:</label>
<input id="country" name="Country" required="required" value=""/>
<label for="zip">PIN<span class="required">*</span>:</label>
<input id="zip" name="Zip" required="required" value=""/>
<input type="Submit" value="Submit" id="submit-button"/>
<input type="Reset" value="Reset" id="reset_button"/>
<p id="required-desc"><span class="required">*</span> indicates a required field</p>
</form>
</div>
</div>
</body>
</html>
addnew.css
#main
{
width: 465px;
padding: 20px;
margin: 0px auto;
border: 6px solid #8fb5c1;
border-radius: 15px;
position: absolute;
background-repeat: repeat;
left: 0px;
right: 0px;
}
#main input, #main select, #main textarea, #main label
{
font-size: 15px;
margin-bottom: 2px;
}
#main input, #main select, #main textarea
{
width: 450px;
border: 1px solid #cee1e8;
margin-bottom: 20px;
padding: 4px;
}
#main input:focus, #main select:focus, #main textarea:focus
{
border: 1px solid #afcdd8;
background-color: #ebf2f4;
}
#main textarea
{
height: 80px;
resize: none;
}
#main label
{
display: block;
}
#main .required
{
font-weight: bold;
color: #f00;
}
#main #submit-button, #main #reset_button
{
width: 100px;
background-color:#333;
color:#FFF;
border:none;
display:block;
float:right;
margin-bottom:0px;
margin-right:6px;
background-color:#8FB5C1;
}
#main #submit-button:hover, #main #reset_button :hover
{
background-color: #A6CFDD;
}
#main #submit-button:active, #main #reset_button:active
{
position:relative;
top:1px;
}
#main #loading
{
width:32px;
height:32px;
display:block;
position:absolute;
right:130px;
bottom:16px;
display:none;
}
#errors
{
border: solid 1px #e58e8e;
padding: 10px;
margin: block;
width: 437px;
border-radius: 8px;
background: #ffe6e6 no-repeat 405px center;
display: none;
}
#errors li
{
padding: 2px;
list-style: none;
}
#errors li:before
{
content: '-';
}
#errors #info
{
font-weight: bold;
}
#errors #info:before
{
content: '';
}
#success
{
border: solid 1px #83d186;
padding: 25px 10px;
margin: 25px 0px;
display: block;
width: 437px;
border-radius: 8px;
background: #d3edd3 no-repeat 405px center;
font-weight: bold;
display: none;
}
#errors.visible, #success.visible
{
display: block;
}
#form1 #req-field-desc
{
font-style: italic;
}
Easy enough if you set a width and height.
#load_here object
{
width: 100%;
height: 500px;
}
The problem you'll run into is that there is proportional sizing for this. You'd have to specify both a width and a height, or it will default width: 300px; and height: 150px;. So, if you set width: 100%; but don't set height, it'll render the height at 150px, and vice versa.
I hope this helps. ^^

cannot encircle form html with legend

Alright, I know how the fieldset/legend works out in HTML.
I cannot encircle form html with legend
i don't know why it is not working please HELP!
why my form is not surrounded with my legend
<form id="contact_form" action="#" method="post">
<h5>Contact me</h5>
<fieldset>
<legend>Formularz kontaktowy</legend>
<ul>
<li>
<label for="nom">Nom</label>
<input id="nom" type="text" />
</li>
<li>
<label for="prenom">Prenom</label>
<input id="prenom" type="text" />
</li>
<li>
<label for="mel">Email</label>
<input id="mel" type="text" />
</li>
<li>
<label for="telephone">Telephone</label>
<input id="telephone" type="text" />
</li>
<li>
<label for="mobile">Mobile</label>
<input id="mobile" type="text" />
</li>
</ul>
<p class="submit">
<input type="button" value="ok" alt="send form" id="btn-send" />
</p>
</fieldset>
</form>
MY CSS:
/* --FORMULAIRE-- */
#content #c2 #contact_form{
margin: 5em auto;
width: 330px;
background-color:#E03336;
}
legend {
display: block;
padding-left: 2px;
padding-right: 2px;
border: 3px #000000 solid;
}
#content #c2 #contact_form h5 {
display: none;
}
#content #c2 #contact_form fildset {
overflow: hidden;
}
#content #c2 #contact_form ul {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
}
#content #c2 #contact_form ul li {
margin-bottom: 10px;
}
#content #c2 #contact_form ul li label {
float: left;
padding: 8px 10px 0 0;
width: 90px;
background-color:#36A643;
color: #348096;
font-size: 1.2em;
font-weight: bold;
text-align: right;
}
#content #c2 #contact_form ul li input {
border-style: ridge;
padding: 3px;
width: 200px;
font-size: 1.2em;
}
#content #c2 #contact_form p.submit {
text-align: center;
}
#content #c2 #contact_form #btn-send{
border-radius:10px;
background-color: #348096;
border-color: #348096;
color: #fff;
}
/* #content #c2 #form_contact {
width: 300px;
margin-left:118px;
margin-top: 59px;
}
#content #c2 input {
float:right;
display:inline;
}
#content #c2 #form_contact label{
font-size: 20px;
width:50px;
display: block;
color: #348096;
clear:both;
float:left;
}
#content #c2 #form_contact #btn_sub {
width: 40px;
margin-top: 25px;
margin-left: 25px;
border-radius:10px;
background-color: #348096;
border: #348096;
}
*/
what i'm doing wrong
Because it is NOT wrapped in legend. Your html should be like so, if you really want to wrap it with the legend tag:
<form id="contact_form" action="#" method="post">
<h5>Contact me</h5>
<fieldset>
<legend>Formularz kontaktowy
<ul>
<li>
<label for="nom">Nom</label>
<input id="nom" type="text" />
</li>
<li>
<label for="prenom">Prenom</label>
<input id="prenom" type="text" />
</li>
<li>
<label for="mel">Email</label>
<input id="mel" type="text" />
</li>
<li>
<label for="telephone">Telephone</label>
<input id="telephone" type="text" />
</li>
<li>
<label for="mobile">Mobile</label>
<input id="mobile" type="text" />
</li>
</ul>
<p class="submit">
<input type="button" value="ok" alt="send form" id="btn-send" />
</p>
</legend>
</fieldset>
</form>
But this makes me wonder why you want to wrap it with legend? Your code was correct. A legend tag in html is just to define the caption of a fieldset.
In addition the answer of uapuap: What you might want to do is to give the fieldset, or the formular the css border.

What to replace <span> in <form> with? "In XHTML 1.1 the tag <form> cannot contain tag <span>

I am a beginner in html. I am using a login module from yootools:
What to replace <span> in with? I have XHTML 1.1 strict doctype (changing transitional fixes it) and I get error:
"In XHTML 1.1 the tag <form> cannot contain tag <span>
This is user/pass box lined up next to each other on the same line. What can I replace these spans with so it doesnt complain?
Thanks!
Maria
Edit: Cleaned up to this now. So I just need to find a way to replace <span class="username"> with something.
<li class="login">
<form action="/cgi-bin/login" method="post" name="Login">
<span class="username">
<input type="text" name="username" size="18" value="Username" />
</span>
<span class="password">
<input type="password" name="passwd" size="10" value="Password" />
</span>
<span class="login-button">
<button value="Login" name="Submit" type="submit" title="L">L</button>
</span>
</form>
</li>
a:focus { outline: none; }
span.username,
span.password {
width: 74px;
height: 16px;
padding: 6px 5px 2px 25px;
float: left;
overflow: hidden;
margin-right: 0px;
}
span.username input,
span.password input {
padding: 0px;
width: 100%;
background: none;
border: none;
outline: none;
float: left;
color: #646464;
font-size: 11px;
}
span.login-button {
margin: 2px 5px 2px 0;
width: 50px;
height: 20px;
float: left;
overflow: hidden;
}
span.login-button button {
display: block;
padding: 0px 0px 0px 0px;
width: 100%;
height: 20px;
border: none;
background: none;
cursor: pointer;
overflow: hidden;
font-size: 11px;
line-height: 20px;
color: #646464;
}
.login {
float:right;
margin:5px 0 0 0;
height: 24px;
display: block;
}
.login span.username {
background: url(img/username_bg.png) 0 0 no-repeat; /* ie6png:crop */
}
.login span.password {
background: url(img/password_bg.png) 0 0 no-repeat; /* ie6png:crop */
}
.login span.username:hover {
background: url(img/username_bg.png) 0 -24px no-repeat;
}
.login span.password:hover {
background: url(img/password_bg.png) 0 -24px no-repeat;
}
.login span.username input:hover,
.login span.password input:hover,
.login span.username input:focus,
.login span.password input:focus {
color: #F2AD29;
}
.login span.login-button {
background: url(img/button_bg.png) 0 0 no-repeat; /* ie6png:crop */
}
.login span.login-button:hover {
background: url(img/button_bg.png) 0 -20px no-repeat;
}
.login span.login-button button:hover {
color: #F2AD29;
}
In the schema http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
The Form Tag can only contain block elements, try this instead:
<li class="login">
<form action="/cgi-bin/login" method="post" name="Login">
<div>
<span class="username">
<input type="text" name="username" size="18" value="Username" />
</span>
<span class="password">
<input type="password" name="passwd" size="10" value="Password" />
</span>
<span class="login-button">
<button value="Login" name="Submit" type="submit" title="L">L</button>
</span>
</div>
</form>
</li>
Just put a <div> tag immediately after the <form> tag and a </div> tag immediately before the </form> tag, and you wont need to change your spans at all.
I think the only difference between having those spans and not having them is that spans are automatically displayed inline, while divs and many other elements (like inputs) are automatically displayed "block." So try just adding display : inline; to the CSS for the two text fields.
Try this instead:
<li class="login-black">
<form action="/cgi-bin/login" method="post" name="Login">
<input type="text" name="username" size="10" value="Username" class="username niftyquick y-login login" />
<input type="password" name="passwd" size="10" value="Password" class="password niftyquick y-login login" />
<input type="hidden" name="remember" value="yes" />
<button value="Login" name="Submit" type="submit" title="L" class="login-button niftyquick y-login login">Log</button>
</form>
</li>
If your spans are only there for styling, apply those classes to the elements themselves instead.