Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying multiple tick boxes side by side using CSS

Status
Not open for further replies.

Floodster

Technical User
Jan 28, 2005
204
If you take a look at : you will see my registration form. I want to try & make it fit a bit better by having the 'Towns' & 'Thematics' side by side but I don't know how to do it.
My CSS code is :
Code:
/*-this is the for the registration form */
#content input.txt{
	color:#00008B;
	background-color:#FFFF99;
	border:1px inset #00008B;
	width:200px;
}
#content form p label{
	float:left;
	width:20em;
	font: bold 90% Georgia, "Times New Roman", Times, serif;
}
#content form p{
	clear:left;
	margin:0;
	margin-left:0.5em;
	padding:0;
	padding-top:0.5em;
}
#content fieldset{
	margin-top:0.2em;
	margin-left:2em;
	margin-right:2em;
	padding:0.2em;

}
#content legend{
	font: 100% Georgia, "Times New Roman", Times, serif;
	background-color:transparent;
}

My html code is:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"><!--[/URL] InstanceBegin template="/Templates/research.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<head>
<META name="keywords" content="Research, Sandwell, Council, Borough, Statistics, Government, Census, Health, Crime, Population, Ethnicity, Datasets, Survey">
<META name="description" content="Research Sandwell provides statistics on the Borough, Towns, Wards and Neighbourhoods within Sandwell. We also provide survey and database support for partnership projects.">
<!--#include virtual="/research/includes/includes.asp" -->
<script type="text/javascript" src="/research/includes/nifty.js"></script>
<script type="text/javascript" src="/research/includes/layout.js"></script>
<script type="text/javascript" src="/research/includes/postcode.js"></script>
<script type="text/javascript" src="/research/includes/search.js"></script>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Research Sandwell</title>
<!-- InstanceEndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="/research/css/menu_new.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/research/css/Print.css" media="print" />
<body>
<!--open contents-->
	<div id="contents">
<!--open header-->
	<div id="header">
<!--close header--></div>
<!--open content-->
	<div id="content"> 
<!--open content_wrapper-->
	<div id="content_wrapper">
<!-- InstanceBeginEditable name="main_layer" --> 
      <h2>Welcome to Research Sandwell Registration</h2>
      <p>In order to gain access to restricted areas &amp; provide you with updates 
        you will need to complete the registration form below. Any information 
        you provide us will be in accordance with the data protection act. <br /><b>You 
        must provide a vaild Email address as an activation link will be sent 
        to this address to validate your account.</b><br /></p>
        
      <h3> <%=sMessage%> </h3>
      <br />
	  <p>Please complete the form below. Mandatory fields marked *.</p>
      <form action="/research/navigation/reg_form.asp" method="post" name="form_reg" id="form_reg" onsubmit="return validate_form2(form_reg)">
		<fieldset>
		<legend>Personal Details</legend>
	      <p><label for="txtuser_name">Full Name *</label>
            <input name="txtuser_name" type="text" id="txtuser_name" value="<%=session("reguser_name")%>" size="50" maxlength="50" class="txt"/>
              </p>           
         <p><label for="txtuser_logname">User Name *</label></td>
          <input name="txtuser_logname" type="text" id="txtuser_logname" value="<%=session("reguser_logname")%>" size="30" maxlength="30" class="txt"/>
           </p>
          <p><label for="txtuser_email">E-mail address *</label>
            <input name="txtuser_email" type="text" id="txtuser_email" value="<%=session("reguser_email")%>" size="50" maxlength="50" class="txt"/></p>
          <p><label for="txtuser_password">Password * (max 10 characters)</label>
             <input name="txtuser_password" type="password" id="txtuser_password" size="11" maxlength="10" class="txt"/></p>
            <p><label for="txtuser_maiden">Mothers Maiden Name *</label>
             <input name="txtuser_maiden" type="password" id="txtuser_maiden" size="50" maxlength="50" class="txt"/></p> 
         <p><label for="txtuser_org">Organisation</label>
            <input name="txtuser_org" type="text" id="txtuser_org" value="<%=session("reguser_org")%>" size="50" maxlength="50" class="txt"/> </p>
            <p><label for="txtuser_job">Job Title</label>
            <input name="txtuser_job" type="text" id="txtuser_job" value="<%=session("reguser_job")%>" size="50" maxlength="50" class="txt"/></p> 
            <p><label for="txtuser_phone">Contact Number</label>
             <input name="txtuser_phone" type="text" id="txtuser_phone" value="<%=session("reguser_phone")%>" size="20" maxlength="20" class="txt"/> </p>
          </fieldset>
          <fieldset>
		  <legend>Which Towns are you interested in?</legend>
		  
          <p><label for="cbuser_oldbury">Oldbury : </label> 
              <input name="cbuser_oldbury" type="checkbox" id="cbuser_oldbury" value="Y" /></p>
           <p><label for="cbuser_rowley">Rowley Regis :</label> 
              <input name="cbuser_rowley" type="checkbox" id="cbuser_rowley" value="Y" /></p>
              <p><label for="cbuser_smethwick">Smethwick :</label> 
              <input name="cbuser_smethwick" type="checkbox" id="cbuser_smethwick" value="Y" /></p>
              <p><label for="cbuser_tipton">Tipton :</label> 
              <input name="cbuser_tipton" type="checkbox" id="cbuser_tipton" value="Y" /></p>
              <p><label for="cbuser_wednesbury">Wednesbury :</label> 
              <input name="cbuser_wednesbury" type="checkbox" id="cbuser_wednesbury" value="Y" /></p>
              <p><label for="cbuser_westbrom">West Bromwich : </label>
              <input name="cbuser_westbrom" type="checkbox" id="cbuser_westbrom" value="Y" /> </p>
            </fieldset>
			<fieldset>
			<legend>Which Thematic Areas are you interested in?</legend>
			<p><label for="cbuser_environment">Environment &amp; Economy :</label> 
              <input name="cbuser_environment" type="checkbox" id="cbuser_environment" value="Y" /></p>
              <p><label for="cbuser_children">Children &amp; Young People : </label>
              <input name="cbuser_children" type="checkbox" id="cbuser_children" value="Y" /></p>
              <p><label for="cbuser_health">Health : </label>
              <input name="cbuser_health" type="checkbox" id="cbuser_health" value="Y" /></p>
              <p><label for="cbuser_skills">Skills &amp; Learning : </label>
              <input name="cbuser_skills" type="checkbox" id="cbuser_skills" value="Y" /></p>
              <p><label for="cbuser_crime">Crime : </label>
              <input name="cbuser_crime" type="checkbox" id="cbuser_crime" value="Y" /> </p>
            </fieldset>
        <p class="term">From time to time we will send you e-mails about your 
          chosen interests. Untick the box if you don't want to be added to our 
          mailing list. 
          <input name="cbuser_notification" type="checkbox" id="cbuser_notification" value="Y" checked="checked" />
        </p>
        <p class="input"> 
          <input type="submit" name="Submit" value="Register" />
          <input type="hidden" name="MM_insert" value="form_reg" />
        </p>
      </form>
      <!-- InstanceEndEditable -->
<!--close content_wrapper--></div>
<!--close content--></div>
<!--open nav-->
	<div id="nav">
<!--open nav_wrapper-->
	<div id="nav_wrapper">
	<%
'do we need to display logout or register??
if Session("sess_User_logname")<>"" then
response.write("<p><strong>"& Session("sess_User_logname") &" is logged in.<a href=""/research/navigation/login.asp?logout=1""><br />Log Out</a></strong></p>")
else response.write("<p><strong><a href=""/research/navigation/login.asp"">Log In</a> / <a href=""/research/navigation/reg_form.asp"">Register</a></strong></p>")
end if
%>
	<ul>
	<li><a href="/research/navigation/home.asp">Home</a></li>
	<li><a href="/research/navigation/most.asp">Most Requested Datasets</a></li>
	<li><a href="/research/navigation/library.asp">Research Library</a></li>
	<li><a href="/research/navigation/interactive_data.asp">Interactive Data</a></li>
	<li><a href="/research/navigation/maps.asp">Maps</a></li>
<%
	if Session("sess_User_Logname")<>"" AND Session("sess_User_Level")>=0 then response.write("<li><a href=""/research/navigation/maintenance.asp"">Database Maintenance</a></li>")
%>
	</ul>
	  <h2>Key Statistic Profiles:</h2>
	<ul>
	<li><a href="/research/navigation/town_template.asp?TOWN=Oldbury&amp;map_id=1">Oldbury</a></li>
	<li><a href="/research/navigation/town_template.asp?TOWN=Rowley%20Regis&amp;map_id=1">Rowley Regis</a></li>
	<li><a href="/research/navigation/town_template.asp?TOWN=Tipton&amp;map_id=1">Tipton</a></li>
	<li><a href="/research/navigation/town_template.asp?TOWN=Smethwick&amp;map_id=1">Smethwick</a></li>
	<li><a href="/research/navigation/town_template.asp?TOWN=West%20Bromwich&amp;map_id=1">West Bromwich</a></li>
	<li><a href="/research/navigation/town_template.asp?TOWN=Wednesbury&amp;map_id=1">Wednesbury</a></li>
	</ul>
	<br />
	<form class="form_nav" action="/research/navigation/search_results.asp" method="post" name="fsearch" id="fsearch" onsubmit="return validate_form(fsearch)">
        Search Research Sandwell: 
        <input name="fid" type="text" id="fid" value="" size="25" maxlength="50" />
        <input name="Search" type="submit" id="Search" value="Search" />
    </form>

	<form class="form_nav" action="/research/navigation/postcode_results.asp" method="post" name="postcode_search" id="postcode_search" onsubmit="return validate_form3(postcode_search)">
        Search for Sandwell postcode: 
        <input name="postid" type="text" id="postid" value="" size="25" maxlength="25" />
      <input name="find" type="submit" id="find" value="Search" />
	 </form>
	 <p class="w3c"><a href="[URL unfurl="true"]http://validator.w3.org/check?uri=referer"><img[/URL] src="[URL unfurl="true"]http://www.w3.org/Icons/valid-xhtml10"[/URL] alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a></p>
	 <p class="smaller">Current users online: <%=Application("Active")%></p>
<!--close nav_wrapper--></div>
<!--close nav--></div>
<!--open footer-->
	<div id="footer">
	 
    <p><a href="/research/navigation/privacy.asp">Privacy</a> | <a href="/research/navigation/accessibility.asp"> 
      Accessibility</a> | <a href="/research/navigation/w3c.asp">W3C Standards</a>| <a href="/research/navigation/site_map.asp">Site Map</a> | <a href="/research/navigation/faq.asp"> 
      FAQ</a> | <a href="/research/navigation/feedback.asp">Feedback</a> | <a href="/research/navigation/ndc.asp">Greets Green</a> | <a href="/research/navigation/contact.asp">Contact Us</a> | 
      <a href="[URL unfurl="true"]http://www.adobe.com/uk/products/acrobat/readstep2.html"[/URL] onclick="MM_openBrWindow('[URL unfurl="true"]http://www.adobe.com/uk/products/acrobat/readstep2.html','WinReport','status=yes,menu=0,toolbar=yes,location=yes,scrollbars=yes,resizable=yes,width=800,height=600');return[/URL] false">Adobe Acrobat</a></p>
<!--close footer--></div>
<!--close contents--></div>
</body>
</html>

I would also like to know how to have say 5 tick boxes in a row so I could use them in surveys eg, agree, disagree, etc, etc but I want to do this without using tables & just pure CSS.

Any help would be appreciated.
Thanks.
 
For the towns and Thematic areas, you could create a class, which floats these sections left and makes their width 50%. Then just set that class on the fieldsets you want to apply that to. You'll also want to add in a clearing tag after these items so the rest of the page continues to flow normally.

- George
 
Also note that by default, any input elements will be inline, so stacking them up in a line is not a problem at all. And with a bit of padding, you can space them any way you want.
 
Guys,
I have implemented your suggestions & I now have some new problems!! Try the previous link to see what I mean.
In IE it now doesn't display the text before the form & it is not lining up the 'Town' <fieldset> correctly. All this works fine in FF??
My new CSS code is :
Code:
/*-this is the for the registration form */
#content input.txt{
	background-color:#FFFF99;
	border:1px inset #00008B;
	width:200px;
	margin-top:0.1em;
	margin-bottom:0.1em;
}
#content form p label{
	float:left;
	width:20em;
	font: bold 90% Georgia, "Times New Roman", Times, serif;
}
#content form p label.tick{
	float:left;
	width:15em;
	font: bold 90% Georgia, "Times New Roman", Times, serif;
}
#content form p{
	clear:left;
	margin-left:0.5em;
	padding:0;
}
#content fieldset{
	margin-left:1em;
	margin-right:1em;
}
#content fieldset.tick2{
	margin-left:4em;
	margin-right:0;
	width:40%;
	float:left;
}
#content fieldset.tick{
	margin:0;
	margin-left:1em;
	margin-right:0em;
	float:left;
	width:40%;
	clear:both;
}
#content legend{
	font: 100% Georgia, "Times New Roman", Times, serif;
	background-color:transparent;
	margin:0;
	padding:0em;
	padding-left:0.2em;
	padding-right:0.2em;
	padding-bottom:0.2em;
	color: #FF0000;
}
.akey{
	text-decoration:underline;
}

& my new html code for the form is :
Code:
      <h2>Welcome to Research Sandwell Registration</h2>
      <p>In order to gain access to restricted areas &amp; provide you with updates 
        you will need to complete the registration form below. Any information 
        you provide us will be in accordance with the data protection act. <br />
        <b>You must provide a vaild Email address as an activation link will be 
        sent to this address to validate your account.</b><br />
      </p>
      <h3> <%=sMessage%> </h3>
      <br />
      <p>Please complete the form below. Mandatory fields marked *.</p>
      <form action="/research/navigation/reg_form.asp" method="post" name="form_reg" id="form_reg" onsubmit="return validate_form2(form_reg)">
        <fieldset>
        <legend><span class="akey">P</span>ersonal Details</legend>
        <p>
          <label for="txtuser_name">Full Name *</label>
          <input name="txtuser_name" type="text" id="txtuser_name" value="<%=session("reguser_name")%>" size="50" maxlength="50" class="txt" accesskey="p"/>
        </p>
        <p>
          <label for="txtuser_logname">User Name *</label></td>
          <input name="txtuser_logname" type="text" id="txtuser_logname" value="<%=session("reguser_logname")%>" size="30" maxlength="30" class="txt"/>
        </p>
        <p>
          <label for="txtuser_email">E-mail address *</label>
          <input name="txtuser_email" type="text" id="txtuser_email" value="<%=session("reguser_email")%>" size="50" maxlength="50" class="txt"/>
        </p>
        <p>
          <label for="txtuser_password">Password * (max 10 characters)</label>
          <input name="txtuser_password" type="password" id="txtuser_password" size="11" maxlength="10" class="txt"/>
        </p>
        <p>
          <label for="txtuser_maiden">Mothers Maiden Name *</label>
          <input name="txtuser_maiden" type="password" id="txtuser_maiden" size="50" maxlength="50" class="txt"/>
        </p>
        <p>
          <label for="txtuser_org">Organisation</label>
          <input name="txtuser_org" type="text" id="txtuser_org" value="<%=session("reguser_org")%>" size="50" maxlength="50" class="txt"/>
        </p>
        <p>
          <label for="txtuser_job">Job Title</label>
          <input name="txtuser_job" type="text" id="txtuser_job" value="<%=session("reguser_job")%>" size="50" maxlength="50" class="txt"/>
        </p>
        <p>
          <label for="txtuser_phone">Contact Number</label>
          <input name="txtuser_phone" type="text" id="txtuser_phone" value="<%=session("reguser_phone")%>" size="20" maxlength="20" class="txt"/>
        </p>
        </fieldset>
        <fieldset class="tick">
        <legend>Which <span class="akey">T</span>owns are you interested in?</legend>
        <p>
          <label for="cbuser_oldbury" class="tick" >Oldbury</label>
          <input name="cbuser_oldbury" type="checkbox" id="cbuser_oldbury" value="Y" accesskey="t"/>
        </p>
        <p>
          <label for="cbuser_rowley" class="tick" >Rowley Regis</label>
          <input name="cbuser_rowley" type="checkbox" id="cbuser_rowley" value="Y" />
        </p>
        <p>
          <label for="cbuser_smethwick" class="tick" >Smethwick</label>
          <input name="cbuser_smethwick" type="checkbox" id="cbuser_smethwick" value="Y" />
        </p>
        <p>
          <label for="cbuser_tipton" class="tick" >Tipton</label>
          <input name="cbuser_tipton" type="checkbox" id="cbuser_tipton" value="Y" />
        </p>
        <p>
          <label for="cbuser_wednesbury" class="tick" >Wednesbury</label>
          <input name="cbuser_wednesbury" type="checkbox" id="cbuser_wednesbury" value="Y" />
        </p>
        <p>
          <label for="cbuser_westbrom" class="tick" >West Bromwich</label>
          <input name="cbuser_westbrom" type="checkbox" id="cbuser_westbrom" value="Y" />
        </p>
        </fieldset>
        <fieldset class="tick2">
        <legend>Which T<span class="akey">h</span>ematics are you interested in?</legend>
        <p>
          <label for="cbuser_environment" class="tick">Environment &amp; Economy</label>
          <input name="cbuser_environment" type="checkbox" id="cbuser_environment" value="Y" accesskey="h"/>
        </p>
        <p>
          <label for="cbuser_children" class="tick" >Children &amp; Young People</label>
          <input name="cbuser_children" type="checkbox" id="cbuser_children" value="Y" />
        </p>
        <p>
          <label for="cbuser_health" class="tick" >Health</label>
          <input name="cbuser_health" type="checkbox" id="cbuser_health" value="Y" />
        </p>
        <p>
          <label for="cbuser_skills" class="tick" >Skills &amp; Learning</label>
          <input name="cbuser_skills" type="checkbox" id="cbuser_skills" value="Y" />
        </p>
        <p>
          <label for="cbuser_crime" class="tick" >Crime</label>
          <input name="cbuser_crime" type="checkbox" id="cbuser_crime" value="Y" />
        </p>
        </fieldset>
        <p class="term">From time to time we will send you e-mails about your 
          chosen interests. Untick the box if you don't want to be added to our 
          mailing list. 
          <input name="cbuser_notification" type="checkbox" id="cbuser_notification" value="Y" checked="checked" />
        </p>
        <p class="input"> 
          <input type="submit" name="Submit" value="Register" />
          <input type="hidden" name="MM_insert" value="form_reg" />
        </p>
      </form>

Any ideas??
 
Guys,

Anybody have any clues to this??

Thanks.
 
Guys,
I'm still struggling with this??

The dissapearing text seems to have resolved itself but I still can't get the Town fieldset to line up correctly.
As I said previous this is all fine in FF.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top