<?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>zomigi.com &#187; HTML</title>
	<atom:link href="http://zomigi.com/tags/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://zomigi.com</link>
	<description>The professional blog of Zoe Mickley Gillenwater</description>
	<lastBuildDate>Thu, 10 May 2012 16:30:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Two usability tips: mean what you say, and use form labels</title>
		<link>http://zomigi.com/blog/two-usability-tips-mean-what-you-say-and-use-form-labels/</link>
		<comments>http://zomigi.com/blog/two-usability-tips-mean-what-you-say-and-use-form-labels/#comments</comments>
		<pubDate>Sat, 09 May 2009 17:08:44 +0000</pubDate>
		<dc:creator>Zoe Gillenwater</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://zomigi.com/?p=108</guid>
		<description><![CDATA[Use language on links that accurately describes what the user is going to get. And, using the (X)HTML label element on form fields is important not just for people with disabilities, but for all of us.]]></description>
			<content:encoded><![CDATA[<p>On Thursday, while I was entering the <a href="http://www.toysrus.com/shop/index.jsp?categoryId=3100133">Babies R Us Mother&#8217;s Day Sweepstakes</a>, I had to choose between two grand prize packages to win. There was a radio button for each package, as well as a link right below each radio button reading &#8220;See All Prizes.&#8221;</p>
<div id="attachment_114" class="wp-caption alignnone" style="width: 570px"><a href="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes1.gif"><img class="size-full wp-image-114"  src="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes1.gif" alt="The &quot;See All Prizes&quot; links below each grand prize package radio button." width="560" height="340" /></a><p class="wp-caption-text">The &quot;See All Prizes&quot; links below each grand prize package radio button.</p></div>
<p>I was happy to see this &#8220;See All Prizes&#8221; link, since I didn&#8217;t know what the difference between the BOB Revolution Stroller and Maclaren Stroller was. So I clicked on the link and got a popup window listing the prizes in each package. But that was it. I didn&#8217;t actually get to <em>see </em>any of the prizes. Nor did I get a description of each item. Nor did I get links to the pages on the Babies R Us site where I could view each item and learn more about it.<br />
<span id="more-108"></span></p>
<div id="attachment_113" class="wp-caption alignnone" style="width: 458px"><a href="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes_popup.gif"><img class="size-full wp-image-113"  src="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes_popup.gif" alt="The popup listing the prizes." width="448" height="435" /></a><p class="wp-caption-text">The popup listing the prizes.</p></div>
<p>I was left still not knowing what the difference between the two strollers was, and thus still didn&#8217;t know what choice I should make. Sure, I could go search for these strollers myself on the Babies R Us site. But I wish they hadn&#8217;t of gotten my hopes up by saying &#8220;See All Prizes,&#8221; when saying &#8220;See List of Prizes&#8221; would have been more accurate and left me less annoyed. (Plus, how hard would it have been to link each prize to its associated product page?)</p>
<p>The lesson here: language does matter. Mean what you say so your users get what they expect to from you.</p>
<p>Back on the form, I randomly picked the second prize package—or at least I tried to. When I clicked on its radio button, the prize lising popup window appeared again. The clickable area of the prize link was overlapping the clickable area of the radio button. I see why they did this—that prize link text is dang small. Expanding its clickable area (via padding in the CSS) helped me select it without having to be terribly precise. But when it came time to actually select a radio button, it made things worse.</p>
<div id="attachment_116" class="wp-caption alignnone" style="width: 270px"><a href="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes4.gif"><img class="size-full wp-image-116"  src="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes4.gif" alt="The clickable area of the link overlaps the radio button, so clicking in the middle of the radio button selects the link, not the button." width="260" height="190" /></a><p class="wp-caption-text">The clickable area of the link overlaps the radio button, so clicking in the middle of the radio button selects the link, not the button.</p></div>
<p>I closed the popup and tried clicking on the label text &#8220;Maclaren Stroller &amp; JJ Cole Package&#8221; right above the radio button. Alas, this did nothing, because this text was not actually marked up as a <code>label</code> element in the HTML. Finally, I was forced to very slowly and precisely move my cursor over the top half of the radio button, where I could finally click to select it.</p>
<div id="attachment_115" class="wp-caption alignnone" style="width: 270px"><a href="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes2.gif"><img class="size-full wp-image-115"  src="http://zomigi.com/wp-content/uploads/2009/05/sweepstakes2.gif" alt="Moving your cursor to the very top of the radio button finally lets you select it instead of the link below." width="260" height="180" /></a><p class="wp-caption-text">Moving your cursor to the very top of the radio button finally lets you select it instead of the link below.</p></div>
<p>Radio buttons are small enough targets to hit as it is. Reducing their clickable area by half because you&#8217;ve overlapped them with the clickable area of an adjacent link makes using them ridiculously difficult. If the label text had been marked up as an actual <code>label</code>, I could have just clicked on this text to select its associated radio button. This helps people with mobility impairments, but as you can see from this example, it helps people without disabilities as well when space is tight and there are lots of little competing things to click on.</p>
<p>The lesson here: use <code>label</code> elements on form fields. Always. It really does matter.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://zomigi.com/blog/hiding-and-revealing-portions-of-images/' title='Hiding and revealing portions of images'>Hiding and revealing portions of images</a></li>
<li><a href='http://zomigi.com/blog/web-accessibility-presentation-resources/' title='Web accessibility presentation and resources'>Web accessibility presentation and resources</a></li>
<li><a href='http://zomigi.com/blog/videos-of-screen-readers-using-aria-updated/' title='Videos of screen readers using ARIA, updated'>Videos of screen readers using ARIA, updated</a></li>
<li><a href='http://zomigi.com/blog/a-few-links-css-and-accessibility/' title='A few links: CSS and accessibility'>A few links: CSS and accessibility</a></li>
<li><a href='http://zomigi.com/blog/videos-of-screen-readers-using-aria/' title='Videos of screen readers using ARIA'>Videos of screen readers using ARIA</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://zomigi.com/blog/two-usability-tips-mean-what-you-say-and-use-form-labels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiding and revealing portions of images</title>
		<link>http://zomigi.com/blog/hiding-and-revealing-portions-of-images/</link>
		<comments>http://zomigi.com/blog/hiding-and-revealing-portions-of-images/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 22:25:32 +0000</pubDate>
		<dc:creator>Zoe Gillenwater</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[elastic]]></category>
		<category><![CDATA[flexible]]></category>
		<category><![CDATA[Flexible Web Design]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[liquid]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[responsive web design]]></category>

		<guid isPermaLink="false">http://zomigi.com/?p=90</guid>
		<description><![CDATA[It's possible to dynamically "crop" both background and foreground images as the layout changes in width, solving the problem of overflowing fixed-width images in a flexible page.]]></description>
			<content:encoded><![CDATA[<p class="note">This tutorial is slightly adapted from Chapter 9 of my book, <a href="http://www.amazon.com/gp/product/0321553845?ie=UTF8&amp;tag=zoeshomepage&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321553845"><em>Flexible Web Design: Creating Liquid and Elastic Layouts with CSS</em></a>. You can download most of <a href="http://www.flexiblewebbook.com/bonus.html">Chapter 9</a> for free as a PDF at the <a href="http://www.flexiblewebbook.com">Flexible Web Design companion site</a>, as well as download the <a href="http://www.flexiblewebbook.com/files.html">HTML, CSS and image files</a> that go along with this tutorial.</p>
<p>Since the area available for an image to display within a flexible layout changes on the fly, your images may need to as well. While fixed-width images can work within flexible layouts—as long as they’re not too large, or you have matching minimum widths in place—there are lots of ways you can dynamically change the screen area that an image takes up.</p>
<p>I&#8217;ve already written about <a href="http://zomigi.com/blog/foreground-images-that-scale-with-the-layout/">how to make images literally scale</a>, but another way to change the amount of screen area an image takes up is to dynamically change how much of the image is shown at any given time. The image itself doesn’t change in size—the amount of space in which it’s allowed to show does, and the rest of the image just remains hidden outside of that space. I call this “variable cropping.”</p>
<p>You can create a variable cropping effect with either background or foreground images. Both look the same, but each is specially suited to different situations.<br />
<span id="more-90"></span></p>
<h3>Variable cropping with background images</h3>
<p>Putting the image that you want to dynamically crop in the background is ideal when the image is purely decorative. This technique lets you keep the image in the CSS with the other decorative images, so if you later change the look of the site, all the decorative images can be changed in a single style sheet instead of having to replace multiple <code>img</code> elements across multiple pages of the site. By keeping the decorative image as a CSS background, you’re also making it likely that the image won’t print when the user prints the page—background printing is turned off by default in all major browsers—so the user can save ink by printing only content.</p>
<p>To use a CSS background image, you’ll fi rst need an element on which to place the background. This example will use a <code>div</code>:</p>
<pre><code>&lt;div id="background"&gt;&lt;/div&gt;</code></pre>
<p>The <code>div</code> is completely empty; it contains no content, but exists simply to hold a background image. If you have a more semantic element you can hang the background on instead, use it. For instance, perhaps the image you want to dynamically crop sits above an <code>h3</code> element and matches it in width. You could add the image as a background to the <code>h3</code> element and give the <code>h3</code> enough top padding to make sure its text sits below the image, not on top of it.</p>
<p>Next, create a rule for this <code>div</code> that sets the image as its non-tiling background:</p>
<pre><code>div#background {
	background: url(styx.jpg) no-repeat;
	border: 2px solid #000;
	}</code></pre>
<p>I’ve added a border on to this <code>div</code> as well so you can easily see where its edges lie. Right now, with no content within the <code>div</code>, it will collapse to zero height. Add dimensions to the <code>div</code> to prop it open:</p>
<pre><code>div#background {
	<em>width: 50%; </em>
	<em>height: 330px;</em>
	background: url(styx.jpg) no-repeat;
	border: 2px solid #000;
	}</code></pre>
<p class="tip">Tip: To dynamically change the height of the image as well as or instead of the width, use a flexible value for the <code>height</code> property.</p>
<p>The width is set to some flexible dimension—either a percentage, as I’ve done here, or an em value to make it elastic—so that the <code>div</code> can change in width to show more or less of the image. The height is set to the pixel height of the image so that the entire height of the image will show at all times.</p>
<p>The <code>div</code> will now always be 50 percent as wide as the viewport; its background image doesn’t change in size, but gets <a href="http://www.zomigi.com/demo/crop_background_right.html">cropped to a varying degree from the right side</a>.</p>
<p>However, this particular image would look better cropped from the left side, as the cat’s face is on the right side of the photo. To specify from where the image gets cropped, use the <code>background-position</code> property, or its shorthand in the <code>background</code> property, to change the alignment of the image within the <code>div</code>:</p>
<pre><code>div#background {
	width: 50%;
	height: 330px;
	background: url(styx.jpg) no-repeat <em>right</em>;
	border: 2px solid #000;
	}</code></pre>
<p>The image is now anchored to the right side of the <code>div</code>, so <a href="http://www.zomigi.com/demo/crop_background.html">more or less of its left side shows as the <code>div</code> changes in size</a>.</p>
<p>This is all the CSS necessary to get the basic variable cropping technique working, but you can add a few other enhancements if you like. For instance, right now, once the <code>div</code> exceeds the width of the image, empty white space shows within the <code>div</code>. There are a few ways you could handle this. You could add a background color to the <code>div</code> as well that would fill up whatever space the image cannot; if you blend the edge of the image into this background color, the effect can look seamless. Or, you could add a maximum width to the <code>div</code> so it can never grow larger than the image. You could also add minimum widths, as well as maximum and minimum heights, to ensure that the <code>div</code> can never grow or shrink past particular<br />
points in the image.</p>
<h3>Variable cropping with foreground images</h3>
<p>If the image that you want to dynamically crop is functional content, you’ll want to keep it as a foreground image by placing it in the (X)HTML using the <code>img</code> element. You can ask yourself these questions to determine if the image is content, not decoration:</p>
<ul>
<li>Does the image convey information that I ought to put as text in an <code>alt</code> attribute?</li>
<li>Do I want to make sure the image always prints because without it the<br />
printout wouldn’t make sense or be complete?</li>
<li>Do I want to link the image?</li>
</ul>
<p>If the answer to any of these questions is yes, the image is content and should be kept in the (X)HTML. CSS background images can’t achieve any of these goals—at least not without some complicated workarounds and hacks, all of which are quite silly, considering how easily a simple <code>img</code> element can achieve all this.</p>
<p>As with the background-image version of the variable cropping technique, you’ll need some block element in the (X)HTML to hold the image. We’ll use a <code>div</code> again; this time it won’t be empty, but will instead contain the img element:</p>
<pre><code>&lt;div id="foreground"&gt;
	&lt;img src="styx.jpg" alt="my cat Styx" width="500" height="330"&gt;
&lt;/div&gt;</code></pre>
<p class="sidenote">Note: The <code>img</code> element has an <code>alt</code> attribute providing the text equivalent of the image. You can’t do this with a CSS background image.</p>
<p>Just as before, the <code>div</code> needs to have a flexible width and a height set to the pixel height of the image:</p>
<pre><code>div#foreground {
	width: 50%;
	height: 330px;
	border: 2px solid #000;
	}</code></pre>
<p>So far, all we have is a regular <code>div</code> holding a regular image—there’s nothing yet that makes this a variable cropping technique. If the image is bigger than the <code>div</code>, it doesn’t get cropped, but simply <a href="http://www.zomigi.com/demo/crop_foreground_overflow.html">overflows</a>.</p>
<p>To get the cropping effect, add <code>overflow: hidden;</code> to the CSS rule:</p>
<pre><code>div#foreground {
	<em>overflow: hidden; </em>
	width: 50%;
	height: 330px;
	border: 2px solid #000;
	}</code></pre>
<p>Now whatever portion of the image would overflow out of the <code>div</code> is <a href="http://www.zomigi.com/demo/crop_foreground_right.html">hidden from view</a>.</p>
<p>Once again, though, it would be better for this image to be cropped from the left side, not the right. We can’t use the <code>background-position</code> property this time because it’s not a background image. To change how a foreground image is anchored within its parent, you can float the image:</p>
<pre><code>div#foreground img {
	float: right;
	}</code></pre>
<p>This anchors the image to the right side of the <code>div</code>, so <a href="http://www.zomigi.com/demo/crop_foreground.html">more or less of its left side shows as the <code>div</code> changes in size</a>. Using a foreground image results in an effect that <a href="http://www.zomigi.com/demo/crop.html">looks exactly like using a background image</a>, but the foreground image has alternative text, and you could also easily add a link to it.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://zomigi.com/blog/foreground-images-that-scale-with-the-layout/' title='Foreground images that scale with the layout'>Foreground images that scale with the layout</a></li>
<li><a href='http://zomigi.com/blog/essential-resources-for-creating-liquid-and-elastic-layouts/' title='70+ essential resources for creating liquid and elastic layouts'>70+ essential resources for creating liquid and elastic layouts</a></li>
<li><a href='http://zomigi.com/blog/creating-sliding-composite-images/' title='Creating sliding composite images'>Creating sliding composite images</a></li>
<li><a href='http://zomigi.com/blog/media-queries-presentation/' title='Media queries presentation at indieconf'>Media queries presentation at indieconf</a></li>
<li><a href='http://zomigi.com/blog/css-summit/' title='Me at The CSS Summit online conference'>Me at The CSS Summit online conference</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://zomigi.com/blog/hiding-and-revealing-portions-of-images/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
	</channel>
</rss>

