cannot encircle form html with legend - html

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.

Related

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. ^^

Email-box shows at "random" place

I'm currently busy with this informatics project(Build a sample datingsite) of mine. The problem is that I'm having some troubles with getting everything in the right place. Everything went fine until my email-box showed up at the wrong place(However, Dreamweaver displays it as I want it). I don't know how, I don't know why but I think it has to do something with my margins or paddings. Any help is appreciated!
Thanks in advance,
HTML+CSS(many words are dutch and I am a beginner to this all, so please don't expect a high quality code. I do have my HTML and CSS in separate files in my real project.):
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
* {
padding:0;
margin:0;
border:0;
}
body {
background-color:#666;
font-family:corbel;
}
.container {
width: 1240px;
}
#HomeLeftSideRegister {
float:left;
}
.Form {
width: 1240px;
height: 600px;
display:block;
background-color:white;
border-radius: 10px;
margin-top: 111px;
margin-left:auto;
margin-right:auto;
}
#Registreernu {
margin-left:45px;
color: #3c948b;
font-size: 70px;
}
#Home-email {
color: #000;
font-size: 30px;
margin-top: 30px;
margin-left: 245px;
}
.Email {
color:#666;
font-weight:bold;
}
#useremail {
height: 22px;
width: 281px;
font-size: 20px;
border-width: 1px;
border-style:solid;
margin: 10px 0px 10px 149px;
}
.Gender {
color: #000;
font-size: 18px;
height: 155px;
width: 130px;
border: none;
float: left;
margin-left: 25px;
margin-top: 10px;
}
#gender-1 {
margin-left:150px;
}
.Radiolabel {
margin-top: 20px;
}
.Roundbutton {
background-color: #3c948b;
height: 74px;
width: 196px;
border-radius: 10px;
color: white;
font-size: 25px;
font-weight: 500;
float:none;
margin-left:193px;
}
#input {
margin-top: 220px;
}
#BlouseManImage {
float:right;
margin: 44px 70px auto auto;
}
</style>
</head>
<body>
<div id="Content" class="Container">
<section id="Home-Register">
<form class="Form" action="#" >
<div id="HomeLeftSideRegister">
<div id="Registreernu">REGISTREER NU</div>
<h2 id="Home-email">EMAIL:</h2>
<input name="email" type="email" class="Email" id="useremail"/>
<fieldset class="Gender" id="gender-1">
<H3>IK BEN EEN:</H3>
<div class="Radiolabel">
<label>
<input type="radio" name="amman" class="styled-radio" value="Man"/>
Man
</label> <br />
<label>
<input type="radio" name="amvrouw" class="styled-radio" value="Vrouw"/>
Vrouw
</label>
</div>
</fieldset>
<fieldset class="Gender">
<H3 class="">IK ZOEK EEN:</H3>
<div class="Radiolabel">
<label>
<input type="radio" name="likeman" class="styled-radio" value="Man"/>
Man
</label>
<br />
<label>
<input type="radio" name="likevrouw" class="styled-radio" value="Vrouw"/>
Vrouw
</label>
<br />
<label>
<input type="radio" name="likebeide" class="styled-radio" value="Beide"/>
Beide
</label>
</div>
</fieldset>
<div id="input">
<input type="submit" value="GA VERDER" class="Roundbutton">
</div>
</div>
<div id="BlouseManImage"><img src="Images/Man_Registreer.jpg" alt="Ik probeer het gewoon" height="535" width="577" />
</div>
</form>
</section>
<section id="reclame">
</section>
</div>
</body>
</html>
it seems you're another victim of the 'float' rule :-)
Your .Gender divs have float: left and it makes these divs go to the left and your email field had to appear to the right.
I solved it making the email field also float, so it gets there first... Also, I had to separate your 2 divs for gender because they are different and one needed to clear the float above so it goes to the row below.
Also, the html had to have name the 2 separated div classes, for GenderBen and GenderZoek.
(I don't know Dutch but I presume it stands for what you are and what you're looking for :-D)
The modified code is:
.Email {
color:#666;
font-weight:bold;
float: left;
}
.GenderBen {
color: #000;
font-size: 18px;
height: 155px;
width: 130px;
border: none;
float: left;
clear: both;
margin-left: 25px;
margin-top: 10px;
}
.GenderZoek {
color: #000;
font-size: 18px;
height: 155px;
width: 130px;
border: none;
float: left;
margin-left: 25px;
margin-top: 10px;
}
And the html with the changed divs:
<fieldset class="GenderBen" id="gender-1">
<H3>IK BEN EEN:</H3>
<div class="Radiolabel">
<label>
<input type="radio" name="amman" class="styled-radio" value="Man"/>
Man
</label> <br />
<label>
<input type="radio" name="amvrouw" class="styled-radio" value="Vrouw"/>
Vrouw
</label>
</div>
</fieldset>
<fieldset class="GenderZoek">
<H3 class="">IK ZOEK EEN:</H3>
<div class="Radiolabel">
<label>
<input type="radio" name="likeman" class="styled-radio" value="Man"/>
Man
</label>
<br />
<label>
<input type="radio" name="likevrouw" class="styled-radio" value="Vrouw"/>
Vrouw
</label>
<br />
<label>
<input type="radio" name="likebeide" class="styled-radio" value="Beide"/>
Beide
</label>
</div>
</fieldset>
Check the result here http://jsfiddle.net/yn8bjfbf/

specific editor settings for css?

hello i have a problem using my editor. i'm using dreamweaver cs6 and would like to use a fieldset.
the problem with that is that i tried to implement my original code from here:
original code
where i thought it used to be same style in my editor. but it is not the same as in the example. as a result i will get this:
as you can see on left hand side it seems to be that there are automatically added tabs in there so that the input fields not flushes with the dark frame.
if there is someone who could tell me how to solve this i really would appreciate. thanks a lot.
UPDATE:
the picture above is what i will see in dreamweaver.
when i publish it on my webserver with that code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Unbenanntes Dokument</title>
<style type="text/css">
#left {
height: 400px;
width: 500px;
float: left;
border: solid 2px #f23;
}
#left #frame {
background-color:#444444;
height: 337px;
width: 440px;
margin-top: 36px;
}
#left #frame form fieldset {
height: 337px;
width: 440px;
color: #FFF;
font-family: Arial, Helvetica, sans-serif;
text-decoration: none;
display: block;
border: none;
}
#left #frame form fieldset h1 {
margin-top: 15px;
font-size: 16px;
font-weight: bold;
margin-left: 10px;
}
#left #frame form fieldset h2 {
font-size: 13px;
font-weight:lighter;
margin-left: 10px;
margin-top: 3px;
}
#left #frame form fieldset ul {
list-style-type: none;
margin-top: 30px;
}
#left #frame form fieldset ul .fl label {
font-size: 12px;
color: #ECECEC;
font-weight: bolder;
width: 80px;
margin-bottom: 2px;
}
#left #frame form fieldset ul .fr label {
font-size: 12px;
color: #ECECEC;
font-weight: bolder;
width: 80px;
margin-bottom: 2px;
}
#left #frame form fieldset ul input {
color: #444444;
font-size: 10px;
width: 180px;
height: 18px;
padding-left: 5px;
outline:none;
}
#left #frame form fieldset ul .fl {
width: 180px;
float: left;
margin-bottom: 15px;
background-color: #f23;
margin-left: 0px;
}
#left #frame form fieldset ul .fr {
width: 180px;
float: right;
margin-bottom: 15px;
background-color: #0F6;
margin-right: 0px;
}
</style>
</head>
<body>
<div id="left">
<div id="frame">
<form action="" method="post">
<fieldset>
<h1>Text 1</h1>
<h2>text 2</h2>
<ul>
<li class="fl">
<label for="label1">Label 1</label>
<input type="text" id="label1" name="label1" tabindex="10" autocomplete="off">
</li>
<li class="fr">
<label for="label2">Label 2</label>
<input type="text" id="label2" name="label2" tabindex="20" autocomplete="off">
</li>
<li class="fl">
<label for="label3">Label 3</label>
<input type="text" id="label3" name="label3" tabindex="30" autocomplete="off">
</li>
<li class="fr">
<label for="label4">Label 4</label>
<input type="text" id="label4" name="label4" tabindex="40" autocomplete="off">
</li>
<li class="fl">
<label for="label5">Label 5</label>
<input type="text" id="label5" name="label5" tabindex="50" autocomplete="off">
</li>
<li class="fr">
<label for="label6">Label 6</label>
<input type="text" id="label6" name="label6" tabindex="60" autocomplete="off">
</li>
</ul>
</fieldset>
</form>
</div>
</div>
</body>
</html>
i will get as a result:
and entering the same code on jsfiddle will result:
this
It will probably be an automatic padding/margin issue, try 0'ing out all your values as the first thing you do, then you can set the values as you want
* {
margin:0;
padding:0;
}

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.

Form Problem in ONLY IE6 and IE7

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.