<?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>DivitoDesign &#187; Usability</title> <atom:link href="http://divitodesign.com/tag/usability/feed/" rel="self" type="application/rss+xml" /><link>http://divitodesign.com</link> <description>Articles, Tutorials and Resources for the Webdesigner</description> <lastBuildDate>Fri, 07 Oct 2011 18:47:18 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Usability Upgrade for Forms With :focus Selector</title><link>http://divitodesign.com/css/usability-upgrade-for-forms-with-focus-selector/</link> <comments>http://divitodesign.com/css/usability-upgrade-for-forms-with-focus-selector/#comments</comments> <pubDate>Mon, 30 Jun 2008 12:31:13 +0000</pubDate> <dc:creator>Stefan Vervoort</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Usability]]></category><guid isPermaLink="false">http://www.divitodesign.com/?p=129</guid> <description><![CDATA[Today we will try to improve the usability of our forms, using the :focus selector. Unfortunately, this selector is only supported by Firefox, Safari and Opera. The Internet Explorer family completely ignore it: Example: Therefore we are able to use it for the other browsers as IE will not preform any action when :focus is [...]]]></description> <content:encoded><![CDATA[<p>Today we will try to improve the <em>usability of our forms, using the :focus selector</em>. Unfortunately, this selector is only supported by Firefox, Safari and Opera. The Internet Explorer family completely ignore it:</p><h2>Example:</h2><p><a href="/dd-articles/focus-example/focus-example.html"><img src="http://www.divitodesign.com/wp-content/uploads/2008/06/example.jpg" alt="" /></a></p><p>Therefore we are able to use it for the other browsers as <abbr title="Internet Explorer">IE</abbr> will not preform any action when <strong>:focus</strong> is used. We will use it today to style and improve forms in CSS for those specific browsers.</p><p><span id="more-129"></span></p><h2>What is the :focus selector?</h2><p>Take a look at the <a href="/dd-articles/focus-example/focus-example.html">live example</a>. When you visit that form of two <em>input</em> fields and one <em>textarea</em>, and you click on input field #2, you will see that input field #2 styled somewhat different as the other two. The <strong>:focus</strong> selector styles that input field #2, because you have selected that field.</p><h3>CSS</h3><div class="fvch-code"><pre class="fvch-line-numbers">1
2
3
4
5
6
7
</pre><pre><span class="css">input, textarea{
<span class="css-property">border<span class="css-selector">:</span><span class="css-value">1px solid #ccc</span></span>;
<span class="css-property">padding<span class="css-selector">:</span><span class="css-value">4px</span></span>;
<span class="css-property">background<span class="css-selector">:</span><span class="css-value">#F4F4F4</span></span>;}</span></pre></div><div class="fvch-code"><pre class="fvch-line-numbers">1
2
3
4
5
6
7
</pre><pre><span class="css">input:focus, textarea:focus{
<span class="css-property">border<span class="css-selector">:</span><span class="css-value">1px solid #000</span></span>;
<span class="css-property">padding<span class="css-selector">:</span><span class="css-value">4px</span></span>;
<span class="css-property">background<span class="css-selector">:</span><span class="css-value">#fff</span></span>;}</span></pre></div><h3>HTML</h3><div class="fvch-code"><pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
</pre><pre><span class="html"><span class="html-form-element">&lt;form method=<span class="html-attribute">&quot;post&quot;</span> action=<span class="html-attribute">&quot;&quot;</span>&gt;</span>
  <span class="html-other-element">&lt;label&gt;</span>Your Name<span class="html-other-element">&lt;br /&gt;</span>  <span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;text&quot;</span> name=<span class="html-attribute">&quot;textfield&quot;</span> /&gt;</span>  <span class="html-other-element">&lt;/label&gt;</span>
  <span class="html-other-element">&lt;label&gt;</span>Your Adress<span class="html-other-element">&lt;br /&gt;</span>    <span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;text&quot;</span> name=<span class="html-attribute">&quot;textfield2&quot;</span> /&gt;</span> <span class="html-other-element">&lt;/label&gt;</span>
  <span class="html-other-element">&lt;label&gt;</span>Details<span class="html-other-element">&lt;br /&gt;</span>    <span class="html-form-element">&lt;textarea name=<span class="html-attribute">&quot;textarea&quot;</span> rows=<span class="html-attribute">&quot;5&quot;</span>&gt;</span><span class="html-form-element">&lt;/textarea&gt;</span>    <span class="html-other-element">&lt;/label&gt;</span>
<span class="html-form-element">&lt;/form&gt;</span></span></pre></div><p>These codes will provide you with the same style declarations as the example shows you and will work in Firefox, Safari and Opera. You should visit the live example as well.</p><h2>Conclusion</h2><p>I think the conclusion is simple: use it. Why shouldn&#8217;t you? You improve the usability for the users who choose for a proper browser, and the users who haven&#8217;t made that choice, don&#8217;t even know the feature is there. I still hope <abbr title="Internet Explorer 8">IE8</abbr> is going to be some-what better in supporting some-more advanced CSS features!</p> ]]></content:encoded> <wfw:commentRss>http://divitodesign.com/css/usability-upgrade-for-forms-with-focus-selector/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 6/12 queries in 0.007 seconds using disk: basic
Object Caching 283/283 objects using disk: basic

Served from: divitodesign.com @ 2012-05-22 10:54:14 -->
