Forum Moderators: not2easy
<!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>
<title>Pictures</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">
<!--
function showMe (it, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = vis;
}
//-->
</script>
</head>
<body>
<div id="page-wrap">
<div id="contact-area">
<form method="post" action="contactengine.php">
<label for="Name">Name:</label>
<input type="text" name="name" id="Name" />
<label for="Email">Email:</label>
<input type="text" name="email" id="Email" />
<div id="methodtext">
Preferred method of contact (check all that apply):
</div>
<div id="prefemail" style="float:left;">
<label for="prefemail">Email</label>
<input name="prefemail" type="checkbox" />
</div>
<div id="prefphone" style="float:left;">
<label for="prefphone">phone</label>
<input name="prefphone" type="checkbox" value="value1" onclick="showMe('btime', this)" />
</div>
<div id="phone" style="float:right;">
<label for="phone">Phone:</label>
<input type="text" name="phone" id="phone" />
</div>
<div class="row" id="btime" style="display:none">
<label for="besttime">Best time to call:</label>
<input type="text" name="besttime" id="besttime" />
</div>
<label for="Message">Message:</label>
<textarea name="Message" rows="20" cols="20" id="Message"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>
<div style="clear: both;"></div>
<p>Stick whatever text here if needed</p>
</div>
</div>
</body>
</html>
.hideRow {
display: none;
}
body {
font-size: 62.5%;
font-family: "Trebuchet MS";
background: url(images/stripe.png) repeat;
}
p {
font-size: 1.3em;
margin-bottom: 15px;
}
#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 500px;
height: auto !important;
height: 500px;
}
#contact-area {
width: 600px;
margin-top: 25px;
}
#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
font-family: "Trebuchet MS";
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #ccc;
}
#phone input, phone textarea {
padding: 5px;
width: 160px;
font-family: Helvetica, sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #ccc;
float: left;
display: block;
}
#btime input, btime textarea {
padding: 5px;
width:160px;
font-family: Helvetica, sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #ccc;
float: right;
}
#prefemail input, prefemail textarea {
padding: 5px;
width: 15px;
font-family: Helvetica, sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 100px;
border: 2px solid #ccc;
}
#prefphone input, prefphone textarea {
padding: 5px;
width:15px;
font-family: Helvetica, sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #ccc;
}
#prefemail label {
text-align: right;
margin-right: 15px;
margin-left: 0px;
width: 50px;
padding-top: 5px;
font-size: 1.4em;
}
#methodtext {
padding: 5px;
width: 325px;
font-family: "Trebuchet MS";
font-size: 1.4em;
margin: 0px 0px 10px 110px;
}
#btime label {
float:left;
text-align: right;
margin-right: 15px;
width: 120px;
padding-top: 5px;
font-size: 1.4m;
height: 16px;
}
#contact-area textarea {
height: 90px;
}
#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #900;
}
#contact-area input.submit-button {
width: 100px;
float: right;
margin-right: 0px;
}
label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}
[edited by: alt131 at 3:17 pm (utc) on Jul 23, 2011]
[edit reason] Thread Tidy - Examplifying [/edit]
In the html remove #methodtext, #prefemail, #prefphone, #phone, #btime and replace with:
<fieldset id="methodtext">
<p>Preferred method of contact (check all that apply):</p>
<label for="prefemail">Email</label>
<input name="prefemail" type="checkbox" />
<label for="prefphone">phone</label>
<input name="prefphone" type="checkbox" value="value1" onclick="showMe('btime', this)" />
</fieldset>
<fieldset id="phone1">
<label for="phone">Phone:</label>
<input type="text" name="phone" id="phone" />
<p id="btime" style="display:none">
<label for="besttime">Best time to call:</label>
<input type="text" name="besttime" id="besttime" />
</p>
</fieldset>
In the css add:
fieldset#methodtext {
/* border just for the example. Fieldset has a border by default, so to remove set border:none*/
border:1px solid red;
width:100%;
/* adjusting unwanted inheritance */
font-size:1em;
line-height:1.6em;
vertical-align:middle;
}
#methodtext p {float:left; margin:0 10px; /*margin is removing unwanted inheritance, then making it look nice - adjust for desired layout */}
#methodtext label {float:none /*adjusting inherited float*/}
#methodtext input {width:20px; margin-right:20px; /*some styles to make it look nicer - will need adjustment for your design*/}
#phone1 {border:1px solid red; width:100%; font-size:0.8em; }
#phone1 p {border:1px solid red; line-height:1.6em; margin:0; /*adjusting for inheritance */ }
#phone1 p label {float:left;}
#phone1 p input {float:none /* adjusting for inheritance */}
I'm not sure *all* browsers implement a fieldset with a border, most doDidnt see this as the major issue facing the OP at this stage, but interesting: The latest I recall is ie3, so it would be extremely helpful if you could provide a list of those that don't.
I've often found it easier to apply a rather hard reset on the styles of form elements in order to get control, but it's by far not easy.And other coders prefer to work with the browsers for exactly that reason, plus start newer coders off with understanding the default behaviour to avoid the over-engineering and problems that creates - as evidenced by the OP. However, as the OP has identified they aren't that experienced, they may not be familiar with the concept of a "hard reset": How about providing a solution for the problem that demonstrates how it works?
@swa66I'm not sure *all* browsers implement a fieldset with a border, most do
Didnt see this as the major issue facing the OP at this stage, but interesting: The latest I recall is ie3, so it would be extremely helpful if you could provide a list of those that don't.