<?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>tjameswhite &#187; (x)HTML</title>
	<atom:link href="http://tjameswhite.com/archives/category/web-development/xhtml/feed/" rel="self" type="application/rss+xml" />
	<link>http://tjameswhite.com</link>
	<description>My infrequent thoughts, ideas and ramblings.</description>
	<lastBuildDate>Thu, 01 Jul 2010 03:09:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rethinking a Table with Media Queries</title>
		<link>http://tjameswhite.com/archives/rethinking-a-table-with-media-queries/</link>
		<comments>http://tjameswhite.com/archives/rethinking-a-table-with-media-queries/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 02:58:54 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[(x)HTML]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[@media]]></category>
		<category><![CDATA[media queries]]></category>
		<category><![CDATA[table data]]></category>

		<guid isPermaLink="false">http://tjameswhite.com/?p=535</guid>
		<description><![CDATA[Attending An Event Apart Boston and going through the W3C&#8217;s Mobile Web Best Practices course has me looking more closely at how I mark up data. 
The main cord that was struck, most directly in Luke Wroblewski&#8217;s Mobile First! talk, but echoed by most every speaker in Boston, is to design from the mobile version [...]]]></description>
			<content:encoded><![CDATA[<p>Attending <a href="http://aneventapart.com/2010/boston/" rel="external">An Event Apart Boston</a> and going through the <acronym title="World Wide Web Consortium">W3C</acronym>&#8217;s <a href="http://www.w3.org/2010/03/MobiWeb107/" rel="external">Mobile Web Best Practices</a> course has me looking more closely at how I mark up data. </p>
<p>The main cord that was struck, most directly in Luke Wroblewski&#8217;s Mobile First! talk, but echoed by most every speaker in Boston, is to design from the mobile version of your site <strong>first</strong>.  This theme occurs in the Mobile Web course as well.<br />
<span id="more-535"></span><br />
For exercises in the Mobile Web course we have to consider mark up that is mobile friendly. Consider, if you will, a simple data table. In a desktop browser, a table is easy enough to render. See, a <a href="/demos/media-queries/simple-table.html">simple data table</a>. </p>
<p>However, on a mobile device with its much narrower screen, a table simply won&#8217;t fit. Instead, the data may be better presented in an alternate form, such as a definition list. (Please note, this is but one example and does not mean that all tables can be equated to a definition list.)</p>
<p>Call me Marie, but I want to have my cake and eat it to.</p>
<h3>Enter the Media Query</h3>
<p>So what is a media query? There are <a href="http://www.google.com/search?hl=en&amp;q=css%20media%20query&amp;aq=f&amp;oq=" rel="external">lots of resources out there</a>. Let me sum it up: media queries allow you to specify CSS rules base not on a device, but on a set of circumstances.</p>
<p>The following block of code applies to any device that claims to be a screen. It will simply make level 1 headers blue:</p>
<pre><code>@media screen {
  h1 {color: blue;}
}</code></pre>
<p>Let&#8217;s through a query into the mix:</p>
<pre><code>@media screen <ins>and (max-width: 500px)</ins>  {
  h1 {color: red;}
}</code></pre>
<p>Now the style applies to any device that claims to be a screen <strong>and</strong> has a width of 500px or less. There are several other properties that can be queried, but this works for our demo.</p>
<p>Let&#8217;s put a query into play on this <a href="/demos/media-queries/floating-query.html">simple demo page</a>. You should see a green masthead across the top of the page and two gray boxes sitting next to each other. Now narrow your browser.</p>
<p>When your browser gets to 500px wide you should see the green masthead change to gray and the gray boxes become blue and stack on top of each other. The code is quite simple:</p>
<pre><code>@media all and (max-width: 500px)  {
	#header {background: #ddd;} /* little color change */
	.column {
		float: none; /* linearize */
		width: 95%; /* reset width */
		background: #6374AB;
		color: #FFF;
		}
}</code></pre>
<h3>The Trouble with Tables</h3>
<p>Let&#8217;s take the same page and <a href="/demos/media-queries/data-table.html">add our simple table to it</a>. Looks fine so far, right? Now narrow your browser.</p>
<p>Once again at the threshold of 500px you should see the boxes stack and the colors change. But this time there is a horizontal scroll because the table needs to be wide enough for it&#8217;s content.</p>
<p>The problem: we came at this from the desktop first. What if we reversed that and thought about the small screen first, then adapted it for the desktop?</p>
<h3 lang="fr">Ce n&#8217;est pas une table</h3>
<p>For our little demo, it isn&#8217;t too difficult to re-imaging that <a href="/demos/media-queries/definition-list.html">tabular data as a definition list</a> (or series of list in this case), which should work nicely on most any mobile device. The code looks something like this:</p>
<pre><code>&lt;dl&gt;
	&lt;dt&gt;Ekstr&ouml;m&lt;/dt&gt;
	&lt;dd&gt;&lt;span class="label"&gt;Points: &lt;/span&gt;44&lt;/dd&gt;
	&lt;dd&gt;&lt;span class="race"&gt;Race 1: &lt;/span&gt;10&lt;/dd&gt;
	&lt;dd&gt;&lt;span class="race"&gt;Race 2: &lt;/span&gt;2&lt;/dd&gt;
	&lt;dd&gt;&lt;span class="race"&gt;Race 3: &lt;/span&gt;-&lt;/dd&gt;
&lt;/dl&gt;</code></pre>
<p>So we&#8217;ve got our cake. Now to eat it too.</p>
<p>Definition lists are just fine in a desktop browser, but I really want this to be more table-like.</p>
<p>You&#8217;ll notice that there are already some <code>class</code> attributes. We just need to add a little more markup to create what will become the table headers:</p>
<pre><code>&lt;div class="head"&gt;
  &lt;div class="row"&gt;
	&lt;div class="dataHead"&gt;&lt;abbr title="position"&gt;Pos.&lt;/abbr&gt;&lt;/div&gt;
	&lt;div class="dataHead"&gt;Driver&lt;/div&gt;
	&lt;div class="dataHead"&gt;&lt;abbr title="points"&gt;Pt.&lt;/abbr&gt;&lt;/div&gt;
	&lt;div class="dataHead"&gt;Hockenheim&lt;/div&gt;
	&lt;div class="dataHead"&gt;Oscherslebe&lt;/div&gt;
	&lt;div class="dataHead"&gt;EuroSpeedway&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</code></pre>
<p>and style with <code>display: table</code> and related properties. For example:</p>
<pre><code>dl, .row {display: table-row;}
.dataHead, dd, dt {display: table-cell;}</code></pre>
<p>(<a href="/demos/media-queries/data-list.css">View the complete CSS</a>)</p>
<p>We now have markup that is mobile friendly styled in a desktop friendly way. All that is left is to undo those desktop styles for small screen display using our media query. Mostly this involves <code>display: block</code> to counteract the table display properties.</p>
<p>The end result: a <a href="/demos/media-queries/data-list.html">desktop and mobile friendly web page</a>. Once again, with a device wider than 500px you should see green color and a basic table. Narrow your browser to less than 500px &hellip; presto! our definition list re-emerges.</p>
<p>I&#8217;ve used a similar media query on this site. Narrow your browser and it should revert to one column.</p>
<h3>Caveat</h3>
<p>No, this is not a perfect solution. It is <em>a</em> solution. If you look at the full code you will see some markup that may be questionable (the first <code>dd</code> in the lists). I merely present this to get us all thinking about they way we think about and markup data.</p>
<p>Your mileage may vary; use at your own risk; objects in mirror may be close than they appear; etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://tjameswhite.com/archives/rethinking-a-table-with-media-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semantic Markup &amp; Microformats</title>
		<link>http://tjameswhite.com/archives/semantic-markup-microformats/</link>
		<comments>http://tjameswhite.com/archives/semantic-markup-microformats/#comments</comments>
		<pubDate>Fri, 15 Jul 2005 00:26:30 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[(x)HTML]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.tjameswhite.com/blog/archives/2005/07/semantic-markup-microformats/</guid>
		<description><![CDATA[In which we explore the semantics of using italics, emphasis and cite, with a microformat as a possible solution.]]></description>
			<content:encoded><![CDATA[<h3>Beginning with Standards</h3>
<p>During the past year I&#8217;ve become interested in using web standards and semantic markup. The idea  is to separate content from presentation. For example, I have followed a variety of holy wars over the use of <code>&lt;i&gt;</code> (italics) and <code>&lt;em&gt;</code> (emphasis) elements. Italics are presentations, emphasis describes the content.  The <code>&lt;i&gt;</code> element has been depreciated in favor of <code>&lt;em&gt;</code>, but that leaves a few things hanging. For instance, how should I code a book or movie title?</p>
<p>I follow the convention that book titles should be italicized, eg. <i>The Stars My Destination</i>. But if <code>&lt;i&gt;</code> has been depreciated, that leaves <code>&lt;em&gt;</code>, which isn&#8217;t the correct choice &#8212; I&#8217;m not emphasizing the title, I just want to note that it <strong>is</strong> a book title.<span id="more-338"></span></p>
<p>So far I&#8217;ve just been talking about a visual distinction. But, as I mentioned at the beginning, I should be separating content from presentation &#8212; as well as adding meaning to that content. So, how is a machine to distinguish a book title from the rest of the content? Presumably the <code>&lt;cite&gt;</code> element, which is <a href="http://www.w3.org/TR/REC-html40/struct/text.html#edef-CITE">vaguely defined</a> as &quot;[c]ontains a citation or a reference to other sources.&quot; While I&#8217;m not convinced that a passing reference to a book constitutes a citation, it is better than using <code>&lt;em&gt;</code> or hacking up a meaningless <code>&lt;span&gt;</code>.</p>
<p>The next problem is that, by default, <code>&lt;cite&gt;</code> renders it&#8217;s content in italics. I prefer following <a href="http://www.mla.org/">MLA</a> <a href="http://www.liu.edu/cwis/cwp/library/workshop/citmla.htm">style</a>, which calls for books, movies, plays, etc. to be italicize (or underlined), while articles, short stories, poems, etc. are quoted: <i>The Stars My Destination</i> (a novel), <i>Fences</i> (a play), <i>Close Encounters of the Third Kind</i> (a movie), &quot;The Tyger&quot; (a poem), &quot;Bastille  Day&quot; (a song), etc. Clearly a basic <code>&lt;cite&gt;</code> element won&#8217;t work for all of these variations.</p>
<p>Additionally, at work I have to use <a href="http://www.ap.org/">AP</a> style for marking up works. AP has a number of quirks, beginning with no italics. Additionally, books, movies, plays, poems, etc. are capitalized and quoted; reference works are not quoted, nor receive any other distinguishing marks.</p>
<p>So, with different types of works and different style guidelines, the <code>&lt;cite&gt;</code> element as-is simply won&#8217;t suffice. We&#8217;ll need to add some classes in order to distinguish types of work. This will give us hooks for styling &#8212; <code>&lt;cite class=&quot;book&quot;&gt;</code> can be italicized or underlined, <code>&lt;cite class=&quot;poem&quot;&gt;</code> would be render normal and even have quotes automatically added around it (at least in CSS 2 compliant browsers). Of course, if you need to follow AP or other style, changing just a couple of properties in the style sheet will take care of that. In the end, we&#8217;ve managed to visually style elements to our desire and added a bit of meaning.</p>
<h3>Enter Microformats</h3>
<p>With the advent of <a href="http://www.microformats.org/">microformats</a>, I now see a way to add more meaning to the classes I would have used simply for styling purposes.  We can add meaningful values the <code>&lt;cite&gt;</code> (or other) element that indexers and others can make use of, all without adding, changing or otherwise hacking existing (X)HTML.</p>
<p><a href="http://dougal.gunters.org/">Dougal Campbel</a>l brought up the idea of a microformat for music tracks and other media on the microformats mailing list. I gather that there are others interested in this as well.</p>
<p>His idea goes far beyond what I was thinking (he mentions track name, running time, etc., ala ID3 tags) and that&#8217;s a good thing. Mention has been made of coming up with a format that would capture ISBN, author, editor, pages, etc. for books, magazines, et al. I&#8217;d like to see this microformat get created, as long as it is done in a modular format.</p>
<p>In other words, Amazon.com could use the full format for marking up books, but in a blog entry, I can use just a minimum of mark up to distinguish that I&#8217;m referring to a book; i.e. <code>&lt;cite class=&quot;scific novel&quot;&gt;</code>The Stars My Destination<code>&lt;/cite&gt;</code>.</p>
<p>I&#8217;d also like to keep it element independent. In other words, I may implement this using the <code>&lt;cite&gt;</code> element, but if you feel strongly about using <code>&lt;em&gt;</code> or definition lists, you can do that. In fact, a definition list is probably a good way for Amazon.com to mark up titles (a block of title-related information) versus a passing reference (an inline mention).</p>
<p>I think that this is an exciting proposition and am interested to hear from others. What are your thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://tjameswhite.com/archives/semantic-markup-microformats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semantic Coding</title>
		<link>http://tjameswhite.com/archives/semantic-coding/</link>
		<comments>http://tjameswhite.com/archives/semantic-coding/#comments</comments>
		<pubDate>Sun, 16 May 2004 14:08:48 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[(x)HTML]]></category>

		<guid isPermaLink="false">http://www.tjameswhite.com/blog/archives/2004/05/semantic-coding/</guid>
		<description><![CDATA[ During the past week there have been a number of posts about semantic markup (see: Andy Budd), specifically about the use of &#60;i&#62; and &#60;b&#62; (see: sidesh0w.com, Matthew Thomas, Luminosity, bestkungfu and cookiecrook).
Since I have recently been changing the way I code by paying more attention to semantics and using the best, cleanest CSS [...]]]></description>
			<content:encoded><![CDATA[<p><!--108471830300047638--> During the past week there have been a number of posts about semantic markup (see: <a href="http://www.andybudd.com/archives/2004/05/semantic_coding/">Andy Budd</a>), specifically about the use of &lt;i&gt; and &lt;b&gt; (see: <a href="http://www.sidesh0w.com/weblog/2004/05/10/flying_car_markup.html">sidesh0w.com</a>, <a href="http://mpt.net.nz/archive/2004/05/09/semantic">Matthew Thomas</a>, <a href="http://illuminosity.net/thoughts/archives/matthew_thomas_semantic_markup/">Luminosity</a>, <a href="http://bestkungfu.com/archive/?id=471">bestkungfu</a> and <a href="http://cookiecrook.com/2004/05/#cc108387135135169014">cookiecrook</a>).</p>
<p>Since I have recently been changing the way I code by paying more attention to semantics and using the best, cleanest <abbr title="Cascading Style Sheets">CSS</abbr> that I can, this has gotten me to thinking.</p>
<p>To sum up the various arguments, the bold and italic attributes shouldn&#8217;t be used (according to the Semantic Coders Guild) because they are purely presentational (ie: visual) and provide no meaning. Instead, they say that we should use the &#8220;semantically correct&#8221; &lt;em&gt; (emphasis, typically italics) and &lt;strong&gt; (strong, typically bold) elements. These elements are useful for things like screen readers for the visually impaired. They literally tell the reader to add emphasis when reading, just like you do when talking. </p>
<p>So how do we convey that via the visual media of the web? CSS allows us to style &lt;em&gt; and &lt;strong&gt; anyway we want to add visual emphasis. </p>
<p>So far so good.</p>
<p>But I began thinking. Is &lt;strong&gt; really a necessary element? It seems redundant and/or meaningless to me. The point of marking something out in bold/strong type is to add emphasis. So why not just use &lt;em&gt;? It would be just as easy, and I would argue just as semantically correct, to use something like &lt;em class=&#8221;italic&#8221;&gt; and &lt;em class=&#8221;bold&#8221;&gt; to change the visual nature of the element while still retaining the semantic emphasis. <span class="small">[Note: the classes mention would, of course, be properly styled in the style sheet with font-style: italic and font-weight: bold. Call the classes whatever you'd like.]</span></p>
<p>My thoughts snowballed from there to the ever-present &lt;span&gt; element. Does it ever serve any semantic purpose? I think the only time I use it is when I need a hook in order to visually style a section of text. (See the note in the previous paragraph.) So, if the Semantic Coders Guild is calling for the end of all non-semantic markup, what do we do with spans? I&#8217;m sure that somewhere, someone has managed to use a span in a semantic way, but I personally can&#8217;t think of any at the moment.</p>
<p>[For those of you who may be looking at the code for this site, don't bother telling me how bad it is. I already know that the code has problems. I haven't bothered to clean it up because I am working on a full redesign - or more correctly, an actual design. While I have been working with HTML for a few years, it is only recently that I have begun to understand and care about the code. At work I am constantly improving my coding habits, moving away form HTML tag soup to proper coding. It is so much easier to maintain. This will be reflected in my new site, whenever it gets done.]</p>
<p>[Oh, I made up the Semantic Coders Guild. If anyone was wondering.]</p>
]]></content:encoded>
			<wfw:commentRss>http://tjameswhite.com/archives/semantic-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweaking</title>
		<link>http://tjameswhite.com/archives/tweaking/</link>
		<comments>http://tjameswhite.com/archives/tweaking/#comments</comments>
		<pubDate>Sat, 05 Apr 2003 19:28:13 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[(x)HTML]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.tjameswhite.com/blog/archives/2003/04/tweaking/</guid>
		<description><![CDATA[ I&#8217;ve just tweaked the stylesheets for all of my pages &#8212; they all now utilizes the same sheets (layout, presentation and print). Also, all of the pages are now, more or less, complient XHTML 1.0 (transitional) and CSS2 (no more tables!).
And, while they all look great in Mozilla (I love this browser), I just [...]]]></description>
			<content:encoded><![CDATA[<p><!--92054556--> I&#8217;ve just tweaked the stylesheets for all of my pages &#8212; they all now utilizes the same sheets (layout, presentation and print). Also, all of the pages are now, more or less, complient XHTML 1.0 (transitional) and CSS2 (no more tables!).</p>
<p>And, while they all look great in <a href="http://www.mozilla.org">Mozilla</a> (I love this browser), I just checked IE 6.0 and it, for some reason is cutting off the blog at the hight of the right-hand box. ::Nevermind. It&#8217;s all better now::</p>
<p>If you are looking for information on using stylesheets, try <a href="http://www.alistapart.com/index.html">A List Apart</a>. And don&#8217;t forget to <a href="http://webstandards.org/act/campaign/buc/">Upgrade Your Browser</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tjameswhite.com/archives/tweaking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
