<?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>Wojciech Bednarski &#187; CSS</title>
	<atom:link href="http://thispaper.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://thispaper.com</link>
	<description>My Piece of The Web</description>
	<lastBuildDate>Sat, 27 Nov 2010 21:30:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The best way to hide content by JavaScript</title>
		<link>http://thispaper.com/2007/12/the-best-way-to-hide-content-by-javascript/</link>
		<comments>http://thispaper.com/2007/12/the-best-way-to-hide-content-by-javascript/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 01:05:59 +0000</pubDate>
		<dc:creator>Wojciech Bednarski</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Usability]]></category>

		<guid isPermaLink="false">http://thispaper.com/?p=18</guid>
		<description><![CDATA[In my daily work I take care of front-end part of quite big factory portal. In small websites I have never seen flickering problem those parts of content which are hiding by JavaScript while page is loading. On enterprise is different. Some pages are incredible big, their parts load from many different sources and I [...]]]></description>
			<content:encoded><![CDATA[<p>In my daily work I take care of front-end part of quite big factory portal. In small websites I have never seen flickering problem those parts of content which are hiding by JavaScript while page is loading. On enterprise is different. Some pages are incredible big, their parts load from many different sources and I see which parts of content are hiding one by one.</p>
<p>I tried to find the best solution, on the Google there isn&#8217;t a lot of information about good practice in JavaScript, however I think that I know how to do this best. I show you few solutions; unaccessible, bugged and accessible solutions.</p>
<p><span id="more-18"></span></p>
<h3>The Goal</h3>
<p>On the page div #book must be visible with JavaScript turned off and not hiding with flickering (blinking) when JavaScript is turned on. After clicked on the headline #book must be showed by JavaScript.</p>
<p>The page without any scripts and hiding CSS &#8211; <a href='http://wojciechbednarski.com/wp-content/uploads/2007/12/example0.html'>example 0</a>.</p>
<h3>Really bad, however not flickering</h3>
<p>The part of the page, that should be showed by JavaScript is hiding by CSS.</p>
<p><strong>CSS code:</strong></p>
<pre>#book {
 display: none
}
</pre>
<p>When JavaScript is on we can show hidden part by mouse click.</p>
<p><strong>JavaScript code:</strong></p>
<pre>$(function() {
$('h2').click(function() {
 $('#book').show();
 });
});
</pre>
<p>When JavaScript is off, the #book is never visible. That solution is not acceptable. <a href='http://wojciechbednarski.com/wp-content/uploads/2007/12/example1.html'>Example 1</a>.</p>
<h3>Accessible but flickering</h3>
<p>Second solution is really simple and accessible, but during hiding parts of content then blinking is appreciable.</p>
<p>Just add hiding class by JavaScript, that you have guaranty when JavaScript is off anyone can see content.</p>
<p><strong>JavaScript code:</strong></p>
<pre>
$(function() {
 $('#book').addClass('javascript);
  $('h2').click(function() {
   $('#book').show();
  });
});
</pre>
<p><strong>CSS code:</strong></p>
<pre>
.javascript {
 display:none
}
</pre>
<p>View <a href='http://wojciechbednarski.com/wp-content/uploads/2007/12/example2.html'>example 2</a>.</p>
<h3>Accessible but document.write</h3>
<p>Yes, that example is accessible but&#8230; Always is but. The problem is in <code>document.write</code>. I think you know what&#8217;s going on with it. Maybe in this case we can use <code>document.write</code>? I&#8217;m really confused at this point. Unfortunately, when we write something with <code>document.write</code> it will not work when we serve it as application/xhtml+xml.</p>
<p><strong>JavaScript code:</strong></p>
<pre>
$(function() {
 $('h2').click(function() {
  $('#book').show();
 });
});

document.write('&lt;style type=\"text/css\" media=\"screen\">
 #book{display:none}
&lt;/style>');
</pre>
<p>View <a href='http://wojciechbednarski.com/wp-content/uploads/2007/12/example3.html'>example 3</a>.</p>
<h3>Accessible, better than previous, but&#8230;</h3>
<p>I hate buts! That example is accessible but to valid this page with any version of HTML or XHTML you have to extend DTD, really.</p>
<p><strong>JavaScript code:</strong></p>
<pre>
$(function() {
 $('h2').click(function() {
  $('#book').show();
 });
});
</pre>
<p><strong>CSS code:</strong></p>
<pre>
#book {
 display:none
}
</pre>
<p><strong>CSS code:</strong></p>
<pre>
&lt;noscript>
 &lt;style type="text/css" media="screen">
 #book {
  display:block
 }
&lt;/style>
&lt;/noscript>
</pre>
<p>The problem of that case: We need to put style inside the noscript tag to show the content when JavaScript is off. We cannot put style tag inside body and we can put noscript tag only inside body tag, disaster&#8230;</p>
<p>View <a href='http://wojciechbednarski.com/wp-content/uploads/2007/12/example4.html'>example 4</a>.</p>
<h3>The winner!</h3>
<p><code>documentElement.className</code> If it is a holy grail of my search? It looks like.</p>
<p>I did not observe any delay during hiding content using this method. Even of a huge page.</p>
<p>How it works? We added class to html tag by JavaScript. Next, each element that should be hidden when JavaScript is turned on, preceded by the class and add to it <code>display:none</code> or something like this. That&#8217;s all.</p>
<p><strong>JavaScript code:</strong></p>
<pre>
document.documentElement.className += " js";

$(function() {
 $('h2').click(function() {
  $('#book').show();
 });
});
</pre>
<p><strong>CSS code:</strong></p>
<pre>
.js #book {
 display:none;
}
</pre>
<p>View <a href='http://wojciechbednarski.com/wp-content/uploads/2007/12/example5.html'>example 5</a>.</p>
<p>To test these examples you can reload it few times to see flickering effect. To show the hidden content, click at headline <q>Wojciech Bednarski&#8217;s favorite book</q>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thispaper.com/2007/12/the-best-way-to-hide-content-by-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Double content</title>
		<link>http://thispaper.com/2007/06/double-content/</link>
		<comments>http://thispaper.com/2007/06/double-content/#comments</comments>
		<pubDate>Fri, 01 Jun 2007 06:50:47 +0000</pubDate>
		<dc:creator>Wojciech Bednarski</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Usability]]></category>

		<guid isPermaLink="false">http://thispaper.com/?p=22</guid>
		<description><![CDATA[I have got a dilemma, because I have to write code (XHTML, CSS and so on) based on design from an agency. Design looks nicely, but usability of it is not so good. Design looks something like this: Related articles (blue one on image) are exactly the same as related article again from right on [...]]]></description>
			<content:encoded><![CDATA[<p>I have got a dilemma, because I have to write code (XHTML, CSS and so on) based on design from an agency. Design looks nicely, but usability of it is not so good.</p>
<p><span id="more-22"></span></p>
<p>Design looks something like this:</p>
<p><img src='http://wojciechbednarski.com/wp-content/uploads/2007/05/example_of_bad_design.gif' alt='example to article' /></p>
<p><strong>Related articles</strong> (blue one on image) are exactly the same as <strong>related article again</strong> from right on the article content. Similarly <strong>useful external links</strong> under the article content are repeated on the right of article content.</p>
<p>So, What is the best way to do this? I see two solutions:</p>
<ol>
<li>Generate twice each of the section in XHTML code (by back-end code)</li>
<li>Generate only once time section which will be repeat and copy them via JavaScript</li>
</ol>
<p>Both solutions are not so good, but if we have got bad design and we don&#8217;t have any possibilities to change it (for example client is to decide on), we must choose solutions.</p>
<p>Why the first is bad?</p>
<ol>
<li>Double content in XHTML code</li>
<li>Accessibility (obstruct browsing from mobile, screen reader has to read the same content again)</li>
<li>SEO (to much the same words in code or something other reason to worse SEO)</li>
<li>We don&#8217;t have possibilities to add any semantic relations between section in code (XHTML is restricted in this case)</li>
</ol>
<p>Why the second is bad?</p>
<ol>
<li>Client has to rendering scripts (performance)</li>
</ol>
<p>I think, the second is better than the first. If you have any ideas leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://thispaper.com/2007/06/double-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>css Zen Garden &#8211; Our House</title>
		<link>http://thispaper.com/2006/09/css-zen-garden-our-house/</link>
		<comments>http://thispaper.com/2006/09/css-zen-garden-our-house/#comments</comments>
		<pubDate>Mon, 04 Sep 2006 23:58:18 +0000</pubDate>
		<dc:creator>Wojciech Bednarski</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css Zen Garden]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://thispaper.com/?p=23</guid>
		<description><![CDATA[Yeah. Finally I&#8217;ve made my own CSS design for Zen Garden and I&#8217;ve submitted it. Unfortunately current processing work submitted is between 1 November 2005 and 1 December 2005. Apparently Dave has many other projects to watch. It takes a few months when my project will be accepted and published. At present you may watch [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah. Finally I&#8217;ve made my own CSS design for <a href="http://www.csszengarden.com">Zen Garden</a> and I&#8217;ve submitted it. Unfortunately current processing work submitted is between 1 November 2005 and 1 December 2005. Apparently <a href="http://www.mezzoblue.com/">Dave</a> has many other projects to watch. It takes a few months when my project will be accepted and published.</p>
<p>At present you may <a href="http://www.csszengarden.com/?cssfile=http://lab.wojciechbednarski.com/zen/ourhouse/sample.css">watch my design here</a>.</p>
<p>I called this design Our House, because everything getting started from the picture named that same. Thanks <strong>Arnie Mateo</strong> for great picture and inspiration.</p>
</div>
<p><span id="more-23"></span></p>
<div lang="en" xml:lang="en">
<p>My design looks good in many browsers like Opera, Firefox and other Gecko based, however only Safari, Konqueror, Shiira, SunriseBrowser and other based on WebCore or KHTML engine support <code>text-shadow</code> property.</p>
<p>Of course Internet Explorers (5, 5.5 and 6.0) display design property, but doesn&#8217;t support any extra CSS techniques like <code>selector:pseudo-class selector</code> so &#8230;</p>
<p>What you think about my design? Any opinion are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://thispaper.com/2006/09/css-zen-garden-our-house/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>High Contrast Layout for WordPress</title>
		<link>http://thispaper.com/2006/08/high-contrast-layout-for-wordpress/</link>
		<comments>http://thispaper.com/2006/08/high-contrast-layout-for-wordpress/#comments</comments>
		<pubDate>Wed, 30 Aug 2006 23:49:54 +0000</pubDate>
		<dc:creator>Wojciech Bednarski</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Usability]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://thispaper.com/?p=24</guid>
		<description><![CDATA[Everybody knows high contrast layout from 456 Berea Street. Because WordPress is very popular publishing platform, I&#8217;ve written similar one to Berea Street zoom layout theme for WordPress. For Who is Zoom Layout? High contrast layout also known as zoom layout is for the low-vision people who use a computer screen. It isn&#8217;t for totally [...]]]></description>
			<content:encoded><![CDATA[<p>Everybody knows high contrast layout from <a href="http://www.456bereastreet.com/">456 Berea Street</a>. Because WordPress is very popular publishing platform, I&#8217;ve written similar one to Berea Street zoom layout theme for WordPress.</p>
<p><strong>For Who is Zoom Layout?</strong></p>
<p>High contrast layout also known as zoom layout is for the low-vision people who use a computer screen. It isn&#8217;t for totally blind people, because they don&#8217;t use a computer screen. Blind people use a screen reader, Braille display and so on.</p>
<p>You may download zoom layout for WordPress from <a href="http://lab.wojciechbednarski.com/wordpress/themes/zoom-layout-HCL/">HCL home page</a>. If you have any comments for <abbr title="High Contrast Layout">HCL</abbr> theme, you may add them below.</p>
</div>
<p><span id="more-24"></span></p>
<div lang="en" xml:lang="en">
<p><strong>More About Zoom Layouts:</strong></p>
<p>If you search for information about zoom layout, <a href="http://joeclark.org/">Joe Clark</a> has some for you. He is building a <a href="http://joeclark.org/access/webaccess/zoom/">repository of information about zoom layouts</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thispaper.com/2006/08/high-contrast-layout-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

