<?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>Christoph Schüßler » jQuery is fun! &#187; XHTML &amp; CSS</title>
	<atom:link href="http://herr-schuessler.de/blog/topics/xhtml-css/feed/" rel="self" type="application/rss+xml" />
	<link>http://herr-schuessler.de/blog</link>
	<description>Christoph Schüßler plans, designs and codes websites, creates user experience and simplifies human computer interaction.</description>
	<lastBuildDate>Tue, 27 Apr 2010 17:18:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>jQuery.popeye 2.0 released</title>
		<link>http://herr-schuessler.de/blog/jquery-popeye-2-0/</link>
		<comments>http://herr-schuessler.de/blog/jquery-popeye-2-0/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 10:24:23 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/blog/?p=311</guid>
		<description><![CDATA[I have just released a new major version of my popular image gallery script jQuery.popeye. It features more customization options, better cross browser and mobile support and tons of bugfixes. I have set up a jQuery.popeye site where you can find documentation and demos. You will also find links to a new feature request forum [...]]]></description>
			<content:encoded><![CDATA[<p>I have just released a new major version of my popular image gallery script jQuery.popeye. It features more customization options, better cross browser and mobile support and tons of bugfixes.<br />
<span id="more-311"></span></p>
<p>I have set up a <a href="http://dev.herr-schuessler.de/jquery/popeye/">jQuery.popeye site</a> where you can find <a href="http://dev.herr-schuessler.de/jquery/popeye/doc.html">documentation</a> and <a href="http://dev.herr-schuessler.de/jquery/popeye/demo.html">demos</a>.</p>
<p>You will also find links to a new feature request forum and bug tracker there. Hope you like the new stuff!</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/jquery-popeye-2-0/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
		<item>
		<title>Overlapping select field bug in IE6 &#8211; solved jQuery-style</title>
		<link>http://herr-schuessler.de/blog/overlapping-select-field-bug-in-ie6-solved-jquery-style/</link>
		<comments>http://herr-schuessler.de/blog/overlapping-select-field-bug-in-ie6-solved-jquery-style/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 08:43:25 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[Browser]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[browser quirks]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/blog/?p=282</guid>
		<description><![CDATA[When using drop-down navigation like Son of Suckerfish, which entails placing absolute positioned layers above the content layer, Internet Explorer 6 displays once again really stupid behavior when it comes to HTML forms with the SELECT element. When the drop-down layer hovers above a form, the SELECT still shines through, it stays above it and [...]]]></description>
			<content:encoded><![CDATA[<p>When using drop-down navigation like <a href="http://htmldog.com/articles/suckerfish/dropdowns/">Son of Suckerfish</a>, which entails placing absolute positioned layers above the content layer, Internet Explorer 6 displays once again really stupid behavior when it comes to <code>HTML</code> forms with the <code>SELECT</code> element. When the drop-down layer hovers above a form, the <code>SELECT</code> still shines through, it stays above it and cannot be convinced by <code>z-index</code> or any other CSS trick to go where it belongs.<br />
<span id="more-282"></span></p>
<p>Some solutions have been proposed, among them:</p>
<ul>
<li>hiding the <code>select</code> element on hover</li>
<li>replacing it with an <code>input</code> element on hover</li>
<li>or <a href="http://www.bringdownie6.com/">stop caring about IE6</a> altogether</li>
</ul>
<p>These solutions all include drawbacks in usability or undesired UI changes, which can be confusing for the user. Another work-around, which is quite unnoticeable in the front-end is to <a href="http://www.macridesweb.com/oltest/IframeShim.html">place an invisible, empty <code>IFRAME</code></a> in the layer that will be positioned above the <code>SELECT</code> element.</p>
<p>Here&#8217;s how to do this jQuery-style:</p>
<p><strong>The jQuery-Plugin:</strong></p>
<pre name="code" class="js">
jQuery.fn.activeXOverlap = function() { 

    $(this).each(function(i){
        var h   = $(this).outerHeight();
        var w   = $(this).outerWidth();
        var iframe  = '<!--[if IE 6]>' +
                      '<iframe src="javascript:false;" style="height: ' +
                      h +
                      'px; width: ' +
                      w +
                      'px" class="selectOverlap">' +
                      '</iframe>' +
                      '<![endif]-->'
        $(this).prepend(iframe);
    });
}
</pre>
<p><strong>The Plugin setup:</strong></p>
<pre name="code" class="js">
$(function() {
    $('.myHoverClass').activeXOverlap();
});
</pre>
<p>where <code>.myHoverClass</code> references all elements that should hover above the select.</p>
<p><strong>The required CSS:</strong></p>
<pre name="code" class="css">
<!--[if IE 6]>
iframe.selectOverlap {
    position: absolute;
    z-index: -1;
    filter: mask();
    border: 0;
    margin: 0;
    padding: 0;
    top: 0;
    left: 0;
    overflow: hidden;
    filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
}
<![endif]-->
</pre>
<p>What this does is placing an <code>Iframe</code> behind every selected element, scaling it to the correct dimensions and hiding it from all browsers but IE6.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/overlapping-select-field-bug-in-ie6-solved-jquery-style/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery.popeye 1.0 released</title>
		<link>http://herr-schuessler.de/blog/jquery-popeye-1-0-released/</link>
		<comments>http://herr-schuessler.de/blog/jquery-popeye-1-0-released/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 09:26:43 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[Browser]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/blog/?p=198</guid>
		<description><![CDATA[jQuery.popeye 2.0 has been released. Older Versions are no longer supported. More than 100 comments on the first release of jQuery.popeye, an appearance on the frontpage of delicious.com and coverage in uncounted blogs&#8230; I certainly didn&#8217;t expect that much interest. The numerous feature requests,  suggestions, bug reports and, in the end, acknowledgments and nice comments [...]]]></description>
			<content:encoded><![CDATA[<div class="redirect">
<a href="http://dev.herr-schuessler.de/jquery/popeye/">jQuery.popeye 2.0</a> has been released. Older Versions are no longer supported.
</div>
<p>More than 100 comments on <a href="http://herr-schuessler.de/blog/jquerypopeye-an-inline-lightbox-alternative/">the first release of <em>jQuery.popeye</em></a>, an appearance on the frontpage of <a href="http://delicious.com/url/1f628122d2c02972da99c352a40003c3">delicious.com</a> and coverage in uncounted blogs&#8230;</p>
<p>I certainly didn&#8217;t expect that much interest. The numerous feature requests,  suggestions, bug reports and, in the end, acknowledgments and nice comments prompted me to continue development, as promised. So <a href="http://plugins.jquery.com/project/popeye">here it is</a>, in a major release, a <strong>completely rewritten and overhauled</strong> <em>jQuery.popeye</em>, the image gallery plugin that started as an alternative to the famous JavaScript <a href="http://www.huddletogether.com/projects/lightbox2/">lightbox</a>.<br />
<span id="more-198"></span></p>
<p><a class="download" href="http://plugins.jquery.com/project/popeye">Download <em>jQuery.popeye 1.0</em><br />
from the jQuery Plugin Repository</a></p>
<h4>What&#8217;s new</h4>
<p>When you <a href="http://dev.herr-schuessler.de/examples/jquery-popeye-1-0/">check out the example installation</a>, you&#8217;ll immediately notice some changes and new features:</p>
<ul>
<li>The <strong>navigation buttons</strong> (next and previous image, enlarge / compact image) have moved. They will appear on mouseover on the popeye box and fade out accordingly. As a result, the user interface is less cluttered with navigational elements.</li>
<li>Navigation is also possible in <strong>enlarged mode</strong>, as this was a big feature request.</li>
<li>The <strong>caption</strong> is hidden by default and also shows on mouseover. It automatically adjusts to the amount of text with a smooth transition.</li>
<li>The <strong>image counter</strong> can be placed either as an overlay above the image (and thus serves as a hint to the user that there&#8217;s more than one image to see), or it can be inserted in the caption or even completely turned of.</li>
<li>There&#8217;s a <strong>new basic skin</strong>. I deliberately kept it quite blunt as to encourage you to design your own skin that better fits your website design. Designing a new skin is quite simple via adjustments to the included jquery.popeye.style.css.</li>
<li>The original image list is hidden via CSS, so the user won&#8217;t see anything until <em>jQuery.popeye</em> has preloaded all the thumbnail images and then inserted the gallery in the page. In order to prevent a jumping effect once the images load, a placeholder <code>div</code> can be added to the original html which will be replaced by the gallery box.</li>
</ul>
<h4>Under the hood</h4>
<p>Version 1.0 comes with a fresh set of options:</p>
<table class="table" border="0">
<tbody>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td class="hilite"><code>jsclass</code></td>
<td>string</td>
<td><code>'ppy-js'</code></td>
<td>a class name applied to the jQuery.popeye root element when JavaScript is active (can be used for extra styling)</td>
</tr>
<tr>
<td class="hilite"><code>nojsclass</code></td>
<td>string</td>
<td><code>'ppy-no-js'</code></td>
<td>the class name of an optional element which can be placed in the HTML code inside the jQuery.popeye root element. This element will be removed once jQuery.popeye has loaded. It can be used as a placeholder.</td>
</tr>
<tr>
<td class="hilite"><code>eclass</code></td>
<td>string</td>
<td><code>'ppy-expanded'</code></td>
<td>a class name to be applied to the enlarged jQuery.popeye box (can be used for extra styling)</td>
</tr>
<tr>
<td class="hilite"><code>lclass</code></td>
<td>string</td>
<td><code>'ppy-loading'</code></td>
<td>a class name to be applied to the stage while loading image (can contain loading indicator graphic)</td>
</tr>
<tr>
<td class="hilite"><code>dlclass</code></td>
<td>string</td>
<td><code>'ppy-left'</code></td>
<td>a class name to be applied to the navigational overlay if popeye opens to the left (can be used to achieve left orientation of overlay)</td>
</tr>
<tr>
<td class="hilite"><code>drclass</code></td>
<td>string</td>
<td><code>'ppy-right'</code></td>
<td>a class name to be applied to the navigational overlay if popeye opens to the right (can be used to achieve right orientation of overlay)</td>
</tr>
<tr>
<td class="hilite"><code>direction</code></td>
<td>string</td>
<td><code>'left'</code></td>
<td>direction that popeye-box opens, can be <code>'left'</code> or <code>'right'</code></td>
</tr>
<tr>
<td class="hilite"><code>duration</code></td>
<td>integer</td>
<td><code>250</code></td>
<td>duration of transitional effect when enlarging or closing the box</td>
</tr>
<tr>
<td class="hilite"><code>opacity</code></td>
<td>integer</td>
<td><code>0.7</code></td>
<td>opacity of navigational overlay</td>
</tr>
<tr>
<td class="hilite"><code>countpos</code></td>
<td>string</td>
<td><code>'overlay'</code></td>
<td>placement of image counter &#8211; can be <code>false</code>, <code>'overlay'</code> or <code>'caption'</code></td>
</tr>
<tr>
<td class="hilite"><code>caption</code></td>
<td>boolean</td>
<td><code>true</code></td>
<td>wether to display a caption based on title attribute</td>
</tr>
<tr>
<td class="hilite"><code>easing</code></td>
<td>string</td>
<td><code>'swing'</code></td>
<td>easing type, can be <code>'swing'</code>, <code>'linear'</code> or any of <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing Plugin</a> types (Plugin required)</td>
</tr>
<tr>
<td class="hilite"><code>nlabel</code></td>
<td>string</td>
<td>n/a</td>
<td>label for next button</td>
</tr>
<tr>
<td class="hilite"><code>plabel</code></td>
<td>string</td>
<td>n/a</td>
<td>label for previous button</td>
</tr>
<tr>
<td class="hilite"><code>oflabel</code></td>
<td>string</td>
<td><code>'of'</code></td>
<td>label for image count text (e.g. 1 <em>of</em> 14)</td>
</tr>
<tr>
<td class="hilite"><code>blabel</code></td>
<td>string</td>
<td>n/a</td>
<td>label for enlarge button</td>
</tr>
<tr>
<td class="hilite"><code>clabel</code></td>
<td>string</td>
<td><code>'Click to close'</code></td>
<td>label for expanded stage (to hint closing)</td>
</tr>
</tbody>
</table>
<h4>Usage</h4>
<p>The HTML structure hasn&#8217;t changed, but if you like, you can now place an extra element (which can serve as a placeholder for users without JS) in the source.</p>
<pre name="code" class="html">
<div class="popeye">
<ul>
<li><a href="url_of_large_image.jpg">
                <img src="url_of_thumbnail.jpg" alt="The caption string" /></a></li>
<li><a href="url_of_large_image.jpg">
                <img src="url_of_thumbnail.jpg" alt="The caption string" /></a></li>
<li><a href="url_of_large_image.jpg">
                <img src="url_of_thumbnail.jpg" alt="The caption string" /></a></li>
<li>...</li>
</ul>
<div class="ppy-no-js">
        This element will be deleted once the gallery loads</div>
</div>
</pre>
<h4>Support</h4>
<p><strike>Please leave your comments and requests here in the blog. Bug reports can also be filed at the <a href="http://plugins.jquery.com/node/add/project-issue/popeye">plugin repository issue tracker</a>. If you make use of <em>jQuery.popeye</em> in one of your projects,I would be really interested to see the result! So feel free to link your site in the comment section.</strike></p>
<div class="redirect">
<a href="http://dev.herr-schuessler.de/jquery/popeye/">jQuery.popeye 2.0</a> has been released. Older Versions are no longer supported.
</div>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/jquery-popeye-1-0-released/feed/</wfw:commentRss>
		<slash:comments>74</slash:comments>
		</item>
		<item>
		<title>Selecting input-fields with maxlength via jQuery</title>
		<link>http://herr-schuessler.de/blog/selecting-input-fields-with-maxlength-via-jquery/</link>
		<comments>http://herr-schuessler.de/blog/selecting-input-fields-with-maxlength-via-jquery/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 04:37:18 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[Browser]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[browser quirks]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[maxlength]]></category>
		<category><![CDATA[selector]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/?p=178</guid>
		<description><![CDATA[524288? 2147483647? -1? No, that&#8217;s not my bank account balance&#8230; Unlike any other attribute, maxlength is implicitly present on any input-element. I had to find this out the hard way trying to select only input-elements with an explicitly set maxlength via the jQuery-selector input[maxlength]. Well, that didn&#8217;t work. input[maxlength] returns all inputs, regardless of whether [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
524288?<br />
2147483647?<br />
-1?<br />
No, that&#8217;s not my bank account balance&#8230;
</p></blockquote>
<p>Unlike any other attribute, <code>maxlength</code> is implicitly present on any <code>input</code>-element. I had to find this out the hard way trying to select only <code>input</code>-elements with an explicitly set <code>maxlength</code> via the jQuery-selector <code>input[maxlength]</code>.<br />
<span id="more-178"></span></p>
<p>Well, that didn&#8217;t work. <code>input[maxlength]</code> returns all inputs, regardless of whether they have <code>maxlength</code> or not. The only conclusion this leaves us with is that <strong>browsers add a certain maxlength-value implicitly</strong> to any <code>input</code>-field.</p>
<h4>What&#8217;s my browser doing with maxlength?</h4>
<p>That&#8217;s exactly what I asked myself. <a href="http://dev.herr-schuessler.de/examples/maxlength-test/">A quick browser test</a> left me quite surprised, but, hey &ndash; what did I expect &#8211; every browser behaving the same? Not in this world&#8230;</p>
<p>Every browser rendering engine implies a different value. The most reasonable browsers are Firefox (surprised?) and Opera &#8211; they are at least assuming a negative value. The other values <del>seem (at least to me, maybe I&#8217;m just missing some nerdy inside joke) completely arbitrary</del> are natural limits: 2147483647 is the highest possible 32-bit-number (<code>2^32 /2</code> or <code>0111 1111 1111 1111 1111 1111 1111 1111</code>), while 524288 is the same in 16 bit:</p>
<table class="table">
<tr>
<th>Browser</th>
<th>OS</th>
<th>Version</th>
<th>Implicit maxlength-value</th>
</tr>
<tr>
<td>Firefox</td>
<td>Windows</td>
<td>3</td>
<td class="hilite">-1</td>
</tr>
<tr>
<td>Internet Explorer</td>
<td>Windows</td>
<td>7</td>
<td class="hilite">2147483647</td>
</tr>
<tr>
<td>Safari</td>
<td>Windows</td>
<td>3.2</td>
<td class="hilite">524288</td>
</tr>
<tr>
<td>Opera</td>
<td>Windows</td>
<td>9.6</td>
<td class="hilite">-1</td>
</tr>
<tr>
<td>Chrome</td>
<td>Windows</td>
<td>0.4</td>
<td class="hilite">524288</td>
</tr>
</table>
<h4>jQuery to the rescue</h4>
<p>So back to the original problem &#8211; my solution for selecting only <code>input</code>-fields with <code>maxlength</code>-attributes based on these findings is as follows:</p>
<pre name="code" class="js">
var inputs = $('input[maxlength!=-1][maxlength!=524288][maxlength!=2147483647]');
</pre>
<p>Ugly, I know. But it works.</p>
<p><a class="download" href="http://dev.herr-schuessler.de/examples/maxlength-test/">Take the <em>Browser Test</em><br />
and post your result in the comment section!</a></p>
<h4>Why?</h4>
<p>Why would I want to select only this subset of input elements anyway? In my case, it was to <a href="http://www.bradlis7.com/main/jquery-chars-remaining">display the number of total and remaining characters a user could enter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/selecting-input-fields-with-maxlength-via-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CSS Image Rollover &#8211; Final Words</title>
		<link>http://herr-schuessler.de/blog/css-image-rollover-final-words/</link>
		<comments>http://herr-schuessler.de/blog/css-image-rollover-final-words/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 13:51:07 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[Deutsch]]></category>

		<guid isPermaLink="false">http://tutorials.anestetic.net/index.php/2007/10/31/css-image-rollover-final-words/</guid>
		<description><![CDATA[In zwei Tutorials hatte ich bereits vorgestellt, wie sich Rollover, also Grafik-Links, die sich beim überfahren mit der Maus ändern, am besten per CSS gestalten lassen. Dieses Tutorial geht noch einen letzten Schritt weiter und fügt eine Kleinigkeit hinzu, die bisher fehlte: den Linktext. In den vorherigen Tutorials und Beispielen hatte ich diesen weggelassen, damit [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://herr-schuessler.de/blog/css-image-rollover-best-practice/">zwei</a> <a href="http://herr-schuessler.de/blog/css-image-rollover-revisited/">Tutorials</a> hatte ich bereits vorgestellt, wie sich Rollover, also Grafik-Links, die sich beim überfahren mit der Maus ändern, am besten per CSS gestalten lassen. Dieses Tutorial geht noch einen letzten Schritt weiter und fügt eine Kleinigkeit hinzu, die bisher fehlte: den Linktext.<br />
<span id="more-15"></span></p>
<p>In den vorherigen Tutorials und Beispielen hatte ich diesen weggelassen, damit die Hintergrundgrafiken, die einem Rollover-Link per CSS zugewiesen werden, nicht vom Linktext, also dem Text zwischen dem öffnenden und schließenden <code>&lt;a&gt;</code>, überlagert werden.</p>
<p><strong>Unschön!</strong> Der entstehende Code hat keine semantische Aussagekraft, von derSuchmaschinenfreundlichkeit ganz zu schweigen. Außerdem zeigen ältere Browser bei Einsatz dieser Technik dann gar nichts an, der Link wird also unsichtbar für den Benutzer. Kurz gesagt: ein Link sollte immer einen Ankertext haben.</p>
<p>Hier also der Code verbesserte Rollover-Code:</p>
<pre name="code" class="html">
<a href="#" class="rollover" id="rollover1">Linktext 1</a>
</pre>
<pre name="code" class="css">
a.rollover {
	display: block;
	float: left;
	width: XYpx; /* Breite einer Rollover-Status-Grafik  */
	height: 0px !important;
	padding-top: XYpx; /* Höhe einer Rollover-Status-Grafik */
	overflow: hidden;
}
#rollover1 {
	background: url(rollover.png) no-repeat left 0px;
}
#meinRollover1:hover {
	background: url(rollover.png) no-repeat left -XYpx; /* Höhe einer Rollover-Status-Grafik (negativ) */
}
#rollover1:active {
	background: url(rollover.png) no-repeat left -XYpx; /* doppelte Höhe einer Rollover-Status-Grafik (negativ) */
}
</pre>
<p>Dabei verwende ich wieder eine Grafik, in der die drei Rollover-Stati übereinander in einer einzigen Datei abgespeichert sind, die dann jeweils nur in ihrer Position als Hintergrundgrafik der Links verschoben wird. Dies geschieht durch die Angabe des negativen Abstands in Pixeln zum oberen Rand der Grafik. Neu ist, dass der Linktext zwar da ist, durch die CSS-Anweisungen aber so weit nach unten verschoben wird, dass er nicht mehr über der Grafik liegt, sondern unsichtbar wird.</p>
<p>Wie das Ergebnis genau aussieht, zeigt <a href="http://dev.herr-schuessler.de/examples/css-image-rollover-final-words/rollover4.html">dieses Beispiel</a>.</p>
<p>Kompatibel mit folgenden Browsern:</p>
<ul>
<li>Mozilla 1.7</li>
<li>Firefox 1+</li>
<li>Opera 9+</li>
<li>Safari (Windows) 3+</li>
<li>Internet Explorer 6+ (allerdings keine Anzeige des dritten Status :active)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/css-image-rollover-final-words/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Div an Float-Höhe anpassen</title>
		<link>http://herr-schuessler.de/blog/div-an-float-hoehe-anpassen/</link>
		<comments>http://herr-schuessler.de/blog/div-an-float-hoehe-anpassen/#comments</comments>
		<pubDate>Thu, 01 Feb 2007 12:17:27 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[Deutsch]]></category>

		<guid isPermaLink="false">http://tutorials.anestetic.net/index.php/2007/02/01/div-an-float-hoehe-anpassen/</guid>
		<description><![CDATA[Häufig wird die CSS-Eigenschaft float benutzt, um mehrere &#60;div&#62; innerhalb einer Eltern-&#60;div&#62; nebeneinander anzuordnen. &#60;div&#62; sind Block-Level-Elemente, erzwingen also eigentlich einen Zeilenumbruch. Durch float: left; lässt sich dies verhindern, mehrere &#60;div&#62; lassen sich so horizontal anordnen. Adiós &#60;table&#62;! So weit alles kalter Kaffee. Liegen diese fließenden &#60;div&#62; innerhalb einer Container-&#60;div&#62;, ergibt sich aber folgendes Problem: [...]]]></description>
			<content:encoded><![CDATA[<p>Häufig wird die CSS-Eigenschaft <code>float</code> benutzt, um mehrere <code>&lt;div&gt;</code> innerhalb einer Eltern-<code>&lt;div&gt;</code> nebeneinander anzuordnen. <code>&lt;div&gt;</code> sind Block-Level-Elemente, erzwingen also eigentlich einen Zeilenumbruch. Durch <code>float: left</code>; lässt sich dies verhindern, mehrere <code>&lt;div&gt;</code> lassen sich so horizontal anordnen. Adiós <code>&lt;table&gt;</code>!</p>
<p>So weit alles kalter Kaffee.<br />
<span id="more-13"></span></p>
<p>Liegen diese fließenden <code>&lt;div&gt;</code> innerhalb einer Container-<code>&lt;div&gt;</code>, ergibt sich aber folgendes Problem: <code>float</code> bewirkt, dass die <code>&lt;div&gt;</code> in der Höhe über die Eltern-<code>&lt;div&gt;</code> (den Container) nach unten herausragen (laut CSS-Spezifikationen auch so vorgesehen&hellip;). In anderen Worten: Der Container &#8220;kennt&#8221; die Höhe seiner Kinder-<code>&lt;div&gt;</code> nicht mehr und erhält als Höhe null, anstatt sich der Höhe seiner Kinder anzupassen und diese zu umschliessen (siehe <a href="http://dev.herr-schuessler.de/examples/div-an-float-hoehe-anpassen/float_in_div1.html">Beispiel 1</a> und folgendes Code-Beispiel).</p>
<pre name="code" class="css">
#child1 {
	float:left;
	width: 250px;
	height: 400px;
}
#child2 {
	float:left;
	width: 350px;
	height: 250px;
}
</pre>
<pre name="code" class="html">
<div id="container">

Hallo, ich bin der container.
<div id="child1">

Ich heiße child1!
</div>
<div id="child2">

Und ich bin child2!
</div>
</div>
</pre>
<p>Die lässt sich einfach durch den altbekannten Trick lösen, unterhalb der fließenden <code>&lt;div&gt;</code>eine Weitere einzufügen, der <code>clear: both;</code> zugewiesen wird. Damit wird der Container gezwungen, seine untere Grenze hinter diesen Paragraphen zu verschieben, er erkennt jetzt scheinbar die Höhe der Kinder-<code>&lt;div&gt;</code> an (siehe <a href="http://dev.herr-schuessler.de/examples/div-an-float-hoehe-anpassen/float_in_div2.html">Beispiel 2</a>).</p>
<pre name="code" class="html">
<div id="container">

Hallo, ich bin der container.
<div id="child1">

Ich heiße child1!
</div>
<div id="child2">

Und ich bin child2!
</div>
<p style="clear:both;">
</div>
</pre>
<p>So weit, so gut. Nur wird dadurch nicht nur ein überflüssiges Element in den Quellcode eingefügt, dieses Element besitzt zudem auch noch keinerlei semantische Bedeutung, es dient lediglich dazu, den Browser auszutricksen.</p>
<p>Dabei lässt sich der gewünschte Effekt auch ohne zusätzliches Markup erreichen, es reicht eine zusätzliche Zeile CSS. Dem Container muss bloß <code>overflow: hidden;</code> zugewiesen werden, so einfach.</p>
<p><strong>Toll.</strong> Funktioniert mal wieder nicht in IE6 und darunter. Der alte Knacker rechnet intern mit einem Model names <a href="http://onhavinglayout.fwpf-webdesign.de/">hasLayout</a>, ein Zustand, der bei vielen HTML-Elementen im IE6 durch das Setzen bestimmter CSS-Eigenschaften hervorgerufen wird. Erst wenn ein Element &#8220;Layout hat&#8221; (<code>hasLayout = true</code>), kann es eine eigene Höhe haben.</p>
<p>Hier liegt der Knackpunkt. Um IE6 dazu zu bewegen, der Container-<code>&lt;div&gt;</code> ebenfalls eine Höhe größer als Null zu spendieren, reicht <code>overflow</code> nicht. Die Rettung bringt hier entweder die Zuweisung einer festen <code>width</code> (also alles außer <code>auto</code>), oder, falls dies aus Designgründen nicht möglich sein sollte, der Einsatz von Microsofts proprietärem CSS-Attribut <code>zoom: 1;</code>.</p>
<p>Für einen umfassenden Hack, der ältere Internet Explorer einschließt, siehe auch <a href="http://www.positioniseverything.net/easyclearing.html">diesen Artikel auf positioniseverything.net</a>.)</p>
<p>Will man den Container auch noch dazu bringen, sich der Breite seiner Kinder anzupassen, anstatt auf volle 100% zu gehen, fügt man noch ein display:table; ein (funktioniert mal wieder nicht in IE). Siehe hierzu <a href="http://dev.herr-schuessler.de/examples/div-an-float-hoehe-anpassen/float_in_div3.html">Beispiel 3</a> und <a href="http://dev.herr-schuessler.de/examples/div-an-float-hoehe-anpassen/float_in_div4.html">Beispiel 4</a>!</p>
<p>Der Vollständige CSS-Code:</p>
<pre name="code" class="css">
#container {
	overflow: hidden;
	display: table;
}
#child1 {
	float:left;
	width: 250px;
	height: 400px;
}
#child2 {
	float:left;
	width: 350px;
	height: 250px;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/div-an-float-hoehe-anpassen/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>CSS Image Rollover &#8211; Revisited</title>
		<link>http://herr-schuessler.de/blog/css-image-rollover-revisited/</link>
		<comments>http://herr-schuessler.de/blog/css-image-rollover-revisited/#comments</comments>
		<pubDate>Wed, 22 Nov 2006 17:20:01 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[Deutsch]]></category>

		<guid isPermaLink="false">http://xhtml.anestetic.net/index.php/2006/11/22/css-image-rollover-revisited/</guid>
		<description><![CDATA[Im letzten Artikel hatte ich beschrieben, wie sich durch Kombinieren von mehreren Rollover-Grafiken in eine Datei erstens Dateigröße und zweitens Reaktionszeit des Rollovers verringern lassen. In diesem Artikel möchte ich diese Taktik auf die Spitze treiben. Wir werden drei Rollover in einer Datei kombinieren und so die Dateigröße weiter drücken &#8211; das ganze natürlich Standardkompatibel [...]]]></description>
			<content:encoded><![CDATA[<p>Im <a href="http://dev.herr-schuessler.de/index.php/2006/09/22/css-image-rollover-best-practice/">letzten Artikel</a> hatte ich beschrieben, wie sich durch Kombinieren von mehreren Rollover-Grafiken in eine Datei erstens Dateigröße und zweitens Reaktionszeit des Rollovers verringern lassen. In diesem Artikel möchte ich diese Taktik auf die Spitze treiben. Wir werden drei Rollover in einer Datei kombinieren und so die Dateigröße weiter drücken &#8211; das ganze natürlich Standardkompatibel und ohne JavaScript.<br />
<span id="more-7"></span></p>
<p>CSS bietet zur Positionierung von Hintergrundgrafiken die 5 Werte <code>left</code>, <code>right</code>, <code>top</code>, <code>bottom </code>und <code>center</code>, wobei <code>center</code> sowohl vertikale als auch horizontale Positionierung einschließt. Aus diesen 5 Werten lässt sich also eine Matrix mit 9 verschiedenen Positionen erstellen:</p>
<table class="table">
<tr>
<td><code>left top</code></td>
<td class="acenter"><code>center top</code></td>
<td class="aright"><code>right top</code></td>
</tr>
<tr>
<td><code>left center</code></td>
<td class="acenter"><code>center center</code></td>
<td class="aright"><code>right center</code></td>
</tr>
<tr>
<td><code>left bottom</code></td>
<td class="acenter"><code>center bottom</code></td>
<td class="aright"><code>right bottom</code></td>
</tr>
</table>
<p>Genau wie diese Matrix lässt sich auch eine Grafik aufbauen, die 3 verschiedene Grafiken mit jeweils 3 Rollover-Stati vereint. Doch zunächst zu den einzelnen Rollover-Grafiken. Ich will auf meiner Website 3 Rollover mit jeweils verschiedenen Grafiken einbauen. Dazu lege ich drei Grafiken an, die jeweils die drei gewünschten Rollover-Stati enthalten (<code>normal</code>, <code>mouseover </code>und <code>click</code>):</p>
<div class="img">
<img id="image10" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_left.gif" alt="Rollover Combined Left" /></p>
<div class="caption">Bild 1 hat eine Dateigröße von 8,16 KB</div>
</div>
<div class="img"><img id="image9" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_center.gif" alt="Rollover Combined Center" /></p>
<div class="caption">Bild 2 hat eine Dateigröße von 3,76 KB</div>
</div>
<div class="img"><img id="image11" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_right.gif" alt="Rollover Combined Right" /></p>
<div class="caption">Bild 3 hat eine Dateigröße von 6,18 KB, macht also insgesamt  18,1 KB. </div>
</div>
<p>Durch folgenden Code lässt sich nun aus jeder dieser Grafiken ein Rollover erstellen:</p>
<pre name="code" class="html">
<a href="#" id="meinRollover1"></a>
</pre>
<pre name="code" class="css">
#meinRollover1 {
	display:block;
	width: 106px;
	height: 118px;
	background: #FFF url(rollover.gif) no-repeat left top;
}
#meinRollover1:hover {
	background: #FFF url(rollover.gif) no-repeat left center;
}
#meinRollover1:active {
	background: #FFF url(rollover.gif) no-repeat left bottom;
}
</pre>
<p>Dabei geben <code>width </code>und <code>height </code>natürlich die Dimensionen <strong>nur eines</strong> der Einzelbilder, die die verschiedenen Stati darstellen, an (<a href="http://dev.herr-schuessler.de/examples/css-image-rollover-revisited/rollover2.html">Beispiel</a>).</p>
<p>Nun kombiniere ich, wie in obiger Matrix, alle 9 Einzelbilder in einer einzigen Datei:</p>
<div class="img"><img id="image8" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined.gif" alt="Rollover Combined" /></div>
<p>Dabei achte ich darauf, dass jedes Einzelbild auch entsprechend seiner CSS-Positionierung in der Datei platziert wird. Jedem Einzelbild wird also genau so viel Platz eingeräumt, wie das größte Einzelbild beansprucht. Ebenso platziere ich die Einzelbilder entsprechend der CSS-Matrix, das Einzelbild zum Beipspiel, das nach der CSS-Matrix sowohl vertikal als auch horizontal zentriert wird, muss also auch in der Datei ebenso zentriert werden. Dies lässt sich in Photoshop besonders leicht durch die Verwendung von Hilfslinien erreichen. Zur Verdeutlichung hier nochmal die kombinierte Grafik mit eingezeichneten Hilfslinien:</p>
<div class="img"><img id="image12" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/11/rollover_combined_hilflinie.gif" alt="Rollover Combined mit Hilfslinien" /></div>
<p>Mit folgendem Code erstelle ich nun 3 völlig voneinander unabhängige Rollover-Links, die alle nur diese einzige Datei verwenden:</p>
<pre name="code" class="html">
<a href="#" id="meinRollover1"></a>
<a href="#" id="meinRollover2"></a>
<a href="#" id="meinRollover3"></a>
</pre>
<pre name="code" class="css">
a {
	display:block;
}
#meinRollover1 {
	width: 106px;
	height: 118px;
	background: #FFF url(rollover_combined.gif) no-repeat left top;
}
#meinRollover1:hover {
	background: #FFF url(rollover_combined.gif) no-repeat left center;
}
#meinRollover1:active {
	background: #FFF url(rollover_combined.gif) no-repeat left bottom;
}
#meinRollover2 {
	width: 44px;
	height: 79px;
	background: #FFF url(rollover_combined.gif) no-repeat center top;
}
#meinRollover2:hover {
	background: #FFF url(rollover_combined.gif) no-repeat center center;
}
#meinRollover2:active {
	background: #FFF url(rollover_combined.gif) no-repeat center bottom;
}
#meinRollover3 {
	width: 104px;
	height: 73px;
	background: #FFF url(rollover_combined.gif) no-repeat right top;
}
#meinRollover3:hover {
	background: #FFF url(rollover_combined.gif) no-repeat right center;
}
#meinRollover3:active {
	background: #FFF url(rollover_combined.gif) no-repeat right bottom;
}
</pre>
<p>Jedem einzelnen Rollover werden dabei die Dimensionen zugewiesen, die das tatsächliche Einzelbild beansprucht, die Positionierungwerte werden aus der CSS-Matrix übernommen.<br />
<a href="http://dev.herr-schuessler.de/examples/css-image-rollover-revisited/rollover3.html">Hier ein funktionierendes Beispiel der 3 Rollover.</a></p>
<p>Das Resultat: Die kombinierte Grafik belegt 14,6 KB, was gegenüber den Deteigrößen der drei einzelnen Grafiken (zusammen 18,1 KB) einer Reduzierung von 20% entspricht.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/css-image-rollover-revisited/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS Image Rollover &#8211; Best practice</title>
		<link>http://herr-schuessler.de/blog/css-image-rollover-best-practice/</link>
		<comments>http://herr-schuessler.de/blog/css-image-rollover-best-practice/#comments</comments>
		<pubDate>Fri, 22 Sep 2006 15:24:51 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[User Interface]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[Deutsch]]></category>

		<guid isPermaLink="false">http://xhtml.anestetic.net/index.php/2006/09/22/css-image-rollover-best-practice/</guid>
		<description><![CDATA[Zum Einstieg in mein neues Blog, in dem ich XHTML- und CSS-Tutorials schreiben werde, möchte ich einen Überblick über den neusten Stand beim Thema Image Rollover geben. Sicherlich sind jedem noch die 50 Zeilen Javascript-Code bekannt, die Adobe ImageReady produziert, um Links mit grafischen Rollover zu versehen. Dabei wurde bei Mouseover über ein Grafik per [...]]]></description>
			<content:encoded><![CDATA[<p>Zum Einstieg in mein neues Blog, in dem ich XHTML- und CSS-Tutorials schreiben werde, möchte ich einen Überblick über den neusten Stand beim Thema Image Rollover geben.<br />
<span id="more-3"></span></p>
<p>Sicherlich sind jedem noch die 50 Zeilen Javascript-Code bekannt, die Adobe ImageReady produziert, um Links mit grafischen Rollover zu versehen. Dabei wurde bei Mouseover über ein Grafik per Javascript der Pfad dieser Grafik durch den Pfad einer Anderen ersetzt. Die Ersatz-Grafiken müssen dabei vorher, ebenfalls per Javascript, in den Browser vorgeladen werden, damit beim Rollover keine Verzögerung auftritt. Obwohl diese Technik inzwischen veraltet ist, produziert ImageReady leider weiterhin diese Lösung.</p>
<p>Die Nachteile dabei sind:</p>
<ul>
<li>Aufspaltung der Rollover-Grafik in 2 Grafiken, dadurch müssen auch 2 HTTP-Requests abgefeuert werden um die Grafiken vom Server zu holen, was sich auf die Ladezeit der Site auswirken kann (wenn viele Rollover benutzt werden),</li>
<li>50 Zeilen Javascript zuviel,</li>
<li>ImageReady bedient sich keiner externen Event-Handler, sondern platziert die Javascript-Aufrufe in den Link-Tags (mittels onmouseover, onmouseout, etc). Dies ließe sich natürlich beheben leicht beheben, doch</li>
<li>der Effekt funktioniert sowieso nicht bei ausgeschaltetem Javascript (D&#8217;Oh).</li>
</ul>
<p>Glücklicherweise gibt es eine Lösung, die ohne Javascript auskommt und dabei ohne CSS-Hacks in allen modernen Browsern funktionieren sollte.</p>
<p>Nehmen wir folgende Grafik:</p>
<div class="img"><img alt="Rollover-Grafik 1" id="image4" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/09/alter_rollover1.png" /></div>
<p>Diese soll mit einem Rollover versehen werden, so dass sie bei Mouseover folgendes anzeigt:</p>
<div class="img"><img alt="Rollover-Grafik 2" id="image5" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/09/alter_rollover2.png" /></div>
<p>Getrennt habe beide Grafiken eine  Dateigröße von knapp 8 Kb und es sind 2 HTTP-Requests nötig, um beide abzurufen.</p>
<p>Kombinieren wir beide Grafiken in eine, indem wir die Höhe der Grafikdatei auf 200% aufziehen und die zweite Grafik unterhalb der ersten platzieren, erhalten wir folgendes:</p>
<div class="img"><img id="image6" alt="Rollover-Grafik 3" src="http://herr-schuessler.de/wp/wp-content/uploads/2006/09/rollover1.png" /></div>
<p>Das Resultat: knapp 7 Kb Dateigröße, ein HTTP-Request &#8211; Ladezeit verringert, Ziel 1 erreicht.</p>
<p>Doch wie wird die Grafik nun eingebunden, damit nicht beide Rollover-Stati gleichzeitig zu sehen sind? Nehmen wir folgenden XHTML-Code</p>
<pre name="code" class="html">
<a href="#" id="meinRollover1"></a>
</pre>
<p>und fügen folgendes als CSS dazu</p>
<pre name="code" class="css">
#meinRollover1 {
	display:block;
	width: 126px;
	height: 151px;
	background: #FFF url(rollover1.png) no-repeat top;
}
</pre>
<p>Zeile 1: Die Umstellung des Inline-Elements A auf ein Block-Level-Element bewirkt, dass wir diesem eine Höhe und Breite zuweisen können. Natürlich nehmen wir hier die Dimensionen der Grafik, als Höhe allerdings die halbe Höhe, also die ursprüngliche Höhe des Teils der Grafik, den wir anzeigen möchten. In Zeile 4 wird die Grafik dem Link dann als Hintergrundbild zugewiesen.</p>
<p>So weit, so gut. Wie kommt nun der Rollover-Effekt zu Stande? Glüclicherweise unterstützen alle Browser den Einsatz des Pseudolements :hover bei Links (bei anderen Elementen tut sich der IE6 immer noch schwer, ihm kann allerdings mit Einbindung der <a href="http://www.xs4all.nl/~peterned/csshover.html">csshover.htc</a> geholfen werden, was wiederrum dazu führt, dass das CSS-Stylesheet nicht mehr korrekt validiert).</p>
<p>Fügen wir also eine weitere CSS-Beschrebung ein:</p>
<pre name="code" class="css">
#meinRollover1:hover {
	background: #FFF url(rollover1.png) no-repeat bottom;
}
</pre>
<p>Eine einzige Zeile CSS reicht hier aus, um den gewünschten Effekt zu erzeugen. Die Hintergrundgrafik wird beim :hover-Status einfach unten ausgerichtet, und das Licht geht an (<a href="http://dev.herr-schuessler.de/examples/css-image-rollover-best-practice/rollover1.html">Beispiel</a>).</p>
<p>Natürlich gib es auch Situationen, in denen man anderen Elementen als einem Link einen grafischen Rollover zuweisen möchte. Hierbei ist, wie oben schon erwähnt, zu beachten, dass nicht alle Browser :hover bei anderen Elementen wie z.B. DIV unterstützen. Hier kann man entweder A-Elemente als Layout-Elemente verwenden, sie per Javascript mittels void(0) deaktivieren und evtl. den Cursor ändern, damit der Benutzer nicht merkt, dass es sich um einen Link handelt. Dies ist aber semantsich nicht korrekt, denn in XHTML ist ein Link ein Link und sollte so verwendet werden.</p>
<p>Stattdessen kann man vorerst nur die Datei csshover.htc in sein Sytlesheet einbinden</p>
<pre name="code" class="css">
html, body {
	behavior:url("csshover.htc");
}
</pre>
<p>was allerdings dann kein valides CSS mehr ist, und darauf warten, dass <del datetime="2006-10-08T11:07:37+00:00">zukünftige Browsergenerationen (Winke Winke, IE7) hier bessere Unterstützung für :hover bieten.</del> <a href="http://blogs.msdn.com/ie/archive/2006/10/06/IE7-Is-Coming-This-Month_2E002E002E00_Are-you-Ready_3F00_.aspx">IE7 wirklich schnell übernommen wird</a>, hier ist <a href="http://blogs.msdn.com/ie/archive/2006/08/22/712830.aspx">das Problem nämlich gelöst</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/css-image-rollover-best-practice/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
