<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MaggsWeb:7 &#187; Web2.0</title>
	<atom:link href="http://www.maggsweb.com/tag/web2-0/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maggsweb.com</link>
	<description>www.maggsweb.com</description>
	<lastBuildDate>Sat, 21 Aug 2010 20:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using CSS for form layout (No more tables.. )</title>
		<link>http://www.maggsweb.com/css/css-form-layout-2/</link>
		<comments>http://www.maggsweb.com/css/css-form-layout-2/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 13:16:39 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web2.0]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.cmaggs.co.uk/html/32</guid>
		<description><![CDATA[Form fields need to line up. OK. Historically this was achieved using a table, and masses of markup. Although that&#8217;s still acceptable and would not fail validation, there is an easier and better way that uses less code and where using the correct tags will also cause the &#8216;name&#8217; field become focused when you clicked [...]]]></description>
			<content:encoded><![CDATA[<p>Form fields need to line up.  OK.  Historically this was achieved using a table, and masses of markup.  Although that&#8217;s still acceptable and would not fail validation, there is an easier and better way that uses less code and where using the correct tags will also cause the &#8216;name&#8217; field become <em>focused </em>when you clicked the &#8216;name&#8217; <em>label</em>.
</p>
<p>
Using CSS we can achieve this using less code, while providing improved usability.
</p>
<p><span id="more-32"></span></p>
<ul>
<li> Use a &lt;P&gt; tag to distinguish each line.</li>
<li> Use a &lt;label&gt; with the <em>name</em> attribute to link to an input with the same name attribute to create the links.</li>
<li> Put the &lt;label&gt; inside the &lt;P&gt; tag with a fixed width, floated left</li>
<li> Use the padding (inside) and margin (outside) on the &lt;P&gt; tag for spacing.</li>
</ul>
<p>Perfect!<br />
<br />
<a href="http://www.maggsweb.com/css/css-form-layout-2/attachment/cssform/" rel="attachment wp-att-375"><img src="http://www.maggsweb.com/wp-content/uploads/2008/03/cssForm.jpg" alt="cssForm" title="cssForm" width="310" height="157" class="size-full wp-image-375" /></a></p>
<p></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p32code3'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p323"><td class="code" id="p32code3"><pre class="html" style="font-family:monospace;">&nbsp;
&lt;form action=&quot;#&quot;&gt;
&lt;p&gt;&lt;label for=&quot;name&quot;&gt;Name&lt;/label&gt;&lt;input id=&quot;name&quot; type=&quot;text&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for=&quot;e-mail&quot;&gt;E-mail&lt;/label&gt;&lt;input id=&quot;e-mail&quot; type=&quot;text&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;&lt;/p&gt;
&lt;/form&gt;</pre></td></tr></table></div>

<p></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p32code4'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p324"><td class="code" id="p32code4"><pre class="css" style="font-family:monospace;">&nbsp;
p <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
p<span style="color: #6666ff;">.submit</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">110px</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span>
label <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/css/css-form-layout-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
