<?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>Templatix Blog &#187; Hacks</title>
	<atom:link href="http://blog.templatix.org/category/hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.templatix.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 20 Jun 2011 17:08:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>PNG transparency in IE5+ and FF</title>
		<link>http://blog.templatix.org/2009/08/png-transparency-in-ie5-and-ff/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=png-transparency-in-ie5-and-ff</link>
		<comments>http://blog.templatix.org/2009/08/png-transparency-in-ie5-and-ff/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 11:44:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=65</guid>
		<description><![CDATA[If you ever had to use GIFs and you know just how jaggedy that transparency around the edges is, the PNG format, with it&#8217;s smooth transparency levels, is purely God-send. it&#8217;s just that IE (5,6,7) is, as usual, so stupid, that it doesn&#8217;t know what to do with the transparent areas and simply puts them [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever had to use GIFs and you know just how jaggedy that transparency around the edges is, the PNG format, with it&#8217;s smooth transparency levels, is purely God-send. it&#8217;s just that IE (5,6,7) is, as usual, so stupid, that it doesn&#8217;t know what to do with the transparent areas and simply puts them over an abnoxious opaque gray rectangle. If you really must have PNG transparency into IE, you must use a dedicated filter (yet another M$ abomination), which filter in turn is able to display a transparent PNG as a background image, like so:</p>
<p><strong>filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src=img/png-file.png);</strong></p>
<p>The most commonly used solution for the geek ones os to implement a javascript programmed to parse the whole shazan, to look for PNG references and, with a global replace, to turn those into filter areas. Since this is a javascript-dependent solution, and since it comes with alterations on the structure of the document, I&#8217;ll just drop it right here and move along to the really intersting part of the problem, which is the simpler CSS solution.</p>
<p>Why CSS? Well, simply because most ofthen than not, you need to use PNGs within an external CSS, and javascript stops there.</p>
<p><em>If you didn&#8217;t get a chance to read the <a href="http://graffiti.hbfx.com/?p=74" target="_blank">!important;</a> article, I strongly recommend you do so before moving along with this article.</em></p>
<p>Normally, in CSS, we set a background image like this:</p>
<p><strong><br />
.style {<br />
background-image: url(</strong><strong>img/png-file.png</strong><strong>);<br />
}</strong></p>
<p>, which works in any sane browser, but not in IE.<br />
In IE, as I was saying, you MUST do it like this:</p>
<p><strong><br />
.style {<br />
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src=img/png-file.png);<br />
}</strong></p>
<p>As you can see, we have two different properties trying to accomplish the same thing. If you already read the above-recommended article, you&#8217;ll understand how the solution to this problem is to apply a double <em><strong>!important;</strong></em> , like this:</p>
<p><strong>.style {</strong></p>
<p><strong> </strong></p>
<p><strong>background-image: url(</strong><strong>img/png-file.png</strong><strong>) !important;<br />
</strong><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>background-image: none</strong><strong>;</strong></p>
<p><strong> </strong></p>
<p><strong>filter: none !important;</strong></p>
<p><strong> </strong></p>
<p><strong>filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src=img/png-file.png);</strong></p>
<p><strong> </strong></p>
<p><strong> }</strong></p>
<p>This way, FF will &#8220;see&#8221; one valid background and zero filters, while IE will &#8220;see&#8221; zero background and one filter. Problem solved. That&#8217;s it for today&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2009/08/png-transparency-in-ie5-and-ff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>!important;</title>
		<link>http://blog.templatix.org/2008/09/important/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=important</link>
		<comments>http://blog.templatix.org/2008/09/important/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 06:05:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=49</guid>
		<description><![CDATA[If you didn&#8217;t know it yet, there&#8217;s a little CSS &#8220;hack&#8221; that, properly used, not only passes all classic validation systems, but is also very useful. We&#8217;re talking about !important;. Basic usage: instead of width: 300px; you can write width: 300px !important;. But, more important, what does it do? Let&#8217;s see&#8230; The basic function of [...]]]></description>
			<content:encoded><![CDATA[<p>If you didn&#8217;t know it yet, there&#8217;s a little CSS &#8220;hack&#8221; that, properly used, not only passes all classic validation systems, but is also very useful. We&#8217;re talking about <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#important-rules" target="_blank"><strong>!important;</strong></a>.</p>
<p>Basic usage: instead of <strong>width: 300px;</strong> you can write <strong>width: 300px !important;</strong>. But, more important, what does it do? Let&#8217;s see&#8230;</p>
<p>The basic function of !important; is to priorotize/set an ierarchy among the CSS properties attached to a page (be those inline or linked in external css files). In this respect, it can be used for 2 main purposes: <span id="more-49"></span></p>
<p><strong>1. </strong>The first purpose, more known, is to differentiate certain properties between <strong>FF and IE</strong>. In this instance, the hack relies on the fact that, in the cases where IE finds 2 definitions of the same property, it tends to prefer the property that doesn&#8217;t have the !important; attached to it.</p>
<p>Example:<br />
Let&#8217;s say we want an element to have in IE width: 100px; and in FF 120px; How do we achieve this? Easy: we write the same property twice: <strong>width: 120px !important; width: 100px;</strong>. FF will understand from this 120px, and IE will understand 100px. Easy, to the point and in many cases very useful.</p>
<p><strong>2. </strong>The second, less known but just as important function, it to <strong>prioritize ierarchically a css property</strong>. What does this mean?</p>
<p><em><strong>A.</strong></em> You may know (or just find out, now) that in CSS you can define CLASSES ot TAGs. The classes are particular cases and are prefixed with a dot, and the tags are global re-definitions of the way HTML tags should display. <strong>body {}</strong> redefines a TAG, and <strong>.body {}</strong> is a CLASS.</p>
<p>What&#8217;s important here is that a TAG&#8217;s properties are superior, ierarchically, to those of a CLASS. If, for instance, I define <strong>p {color: #cccccc;}</strong> and then, in a particular P, I want to use the class <strong>.green {color: #009900;}</strong>, <strong>.green will show up gray, instead of green</strong>, because a <strong>tag</strong> is more general/powerful than a <strong>class</strong>, i.e. <strong>P is more general/powerful than .green</strong>.<br />
<em><strong><br />
B.</strong></em> You may also know (or just find out) that in CSS we can define complex classes. For instance, <strong>.green {}</strong> is one thing, while <strong>.green .title {}</strong> means &#8220;all the <strong>title</strong>s found in a <strong>green</strong>&#8220;. This can help us structure, detail and prioritize very well and in an orderly fashion alot of classes and particular cases.</p>
<p>Getting back to our sheep: the bottomline from paragraphs <em><strong>A</strong></em> and <em><strong>B</strong></em> is that in CSS ierarchy exists and is important.<br />
But what do you do when you need to override that ierarchy? YOU USE <strong>!important;</strong>.</p>
<p>This way, the problem above (the one with p and .green) can be solved like this: <strong>.green {color: #009900 !important;}</strong>. This way, if we use a <strong>.green</strong> in a <strong>p</strong>, the color property in  .green will decome more important/powerful than the one in the p, and display correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2008/09/important/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CLEARFIX &#8211; problem and solution for FF and IE (incluing IE7)</title>
		<link>http://blog.templatix.org/2008/09/clearfix-problem-and-solution-for-ff-and-ie-incluing-ie7/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=clearfix-problem-and-solution-for-ff-and-ie-incluing-ie7</link>
		<comments>http://blog.templatix.org/2008/09/clearfix-problem-and-solution-for-ff-and-ie-incluing-ie7/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 21:36:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=42</guid>
		<description><![CDATA[When working with DIV-s (as I&#8217;ve been doing, for a while now), if you want a layout going down as long as its contend goes, you&#8217;re forced to work with FLOAT-s. That is, with DIV-s that are positioned RELATIVE and that have a float:left or a float:right set up on them. The Problem The problem [...]]]></description>
			<content:encoded><![CDATA[<p>When working with DIV-s (as I&#8217;ve been doing, for a while now), if you want a layout going down as long as its contend goes, you&#8217;re forced to work with <strong>FLOAT</strong>-s. That is, with DIV-s that are positioned RELATIVE and that have a <strong>float:left</strong> or a <strong>float:right</strong> set up on them.</p>
<p><strong>The Problem</strong><br />
The problem is that the FLOAT&#8217;s visual rendering model is an archaic one, dating back when a float was limited to an &lt;IMG&gt;&#8217;s <strong>align: left</strong> / <strong>align: right</strong>, which allowed the text to flow around an image (or an image to &#8220;text-wrap&#8221;). Back in the day, a float was limited, conceptually, to &lt; IMG &gt; si &lt; P &gt;. What resulted from the old model? Something like this:</p>
<p><img src="http://blog.templatix.org/wp-content/uploads/2007/02/tutorial-5.gif" alt="tutorial-5.gif" /></p>
<p>If you look closer, you&#8217;ll see that the image included in the first &lt; P &gt; (marked with magenta in the image) has an align=&#8221;left&#8221; (the functional equivalent of <strong>float: left;</strong> in CSS), which makes the  &lt; P &gt;-s (including the ones to follow) to seamlessly flow around the image. All nice an dandy.</p>
<p>But what do you do when you want that image/float to &#8220;force&#8221; the height of it&#8217;s containing holder? What do you do if you want that &lt; P &gt; -ul containing the image to stretch down in a way to include ALL the image? That was easy peasy with tables, but DIVs make it much harder.<span id="more-42"></span></p>
<p>Why? Because, as I was saying: when they conceived and created the specification for the FLOAT model, the dear W3C guys simply considered the above model to be more natural. Don&#8217;t ask why. What this means, for the coder? A big&#8217;ol pain in the neck, because not only is it a serious issue, but it happens to be a cross-browser one too&#8230;</p>
<p><strong>The Solution?</strong></p>
<p>Various tests yielded various solutions for various browsers.</p>
<p>For instance, <strong>in IE</strong>, setting a <strong>height</strong> of the DIV was enough. And, in order not to affect the layout, it was best to just set the height to 1% &#8211; IE would spread its div-s as needed, anyway, moving through that 1% like mice through cheeze.</p>
<p>But this would wreck a layout <strong>in FF</strong> &#8211; since it had no effect whatsoever. In return, in FF it was enough to manually enter, at the end of the div, an HTML element with the <strong>clear:both</strong> property. This would force the DIV to stretch beyond that little forcepsed-in element, since clear-both allows no other elements to be in the same line with it, thus forcing the div to stretch below it. To better understand this, here&#8217;s another drawing:<br />
<img src="http://blog.templatix.org/wp-content/uploads/2007/02/tutorial-6.gif" alt="tutorial-6.gif" /></p>
<p>(that blue border around that dot illustrates the effect of <strong>clear-both;</strong>)</p>
<p>But since manually inserting code into the HTML just to get this working is rather un-elegant, they came up with another solution: to take advantage of a FF-specific CSS property: <strong>content: &#8220;&#8221;;</strong>. What this does, is it allows you to insert code into the HTML, from the CSS. Obviously, it only works in FF, but it&#8217;s useful in it&#8217;s way.</p>
<p>How can we apply these 2 solutions so far?</p>
<p><strong>FF:</strong></p>
<pre>.clearfix:after {content: "."; display: block; height: 0;
                 clear: both; visibility: hidden;}</pre>
<p><strong>IE:</strong></p>
<pre>* html .clearfix {height: 1%;}</pre>
<p>After which, in HTML, we give our DIV the class &#8220;clearfix&#8221;. And so we get to the famous &#8220;CLEARFIX&#8221; solution, which saved alot of HTML geeks from eternal shame:</p>
<pre>.clearfix:after  {content: "."; display: block; height: 0;
                  clear: both; visibility: hidden;}
/* Hides from IE-mac */
* html .clearfix {height: 1%;}
/* End hide from IE-mac */</pre>
<p>But wait! IE7 came along&#8230; And this trick didn&#8217;t work well with it&#8217;s majesty&#8230; What to do, what to do? Take all the sites you&#8217;ve done so far and start re-coding them just because IE7 is so retarded and clients who suddenly discover IE7 see theirs sites messed-up? This dear IE7 provided alot of meat in we-know-who&#8217;s mouth, fridge and family, especially since they had the nerve to announce that this would be the latest version, after which no more new CSS stuff to be implemented&#8230;</p>
<p>Just our luck (AGAIN) <a title="456bereastreet" href="http://www.456bereastreet.com/archive/200603/new_clearing_method_needed_for_ie7/" target="_blank">a bunck of good guys</a> humped the problem until thei made it squeak, and found a new solution; modify ONLY the CSS, and ONLY the CLEARFIX section, as follows:</p>
<pre>.clearfix:after {content:"."; display:block; height:0;
                 clear:both; visibility:hidden; }
.clearfix       {display:inline-block;}
/* Hide from IE Mac */
.clearfix       {display:block;}
/* End hide from IE Mac */</pre>
<p>Once redefined, this piece of CSS code made it all come back to normal, working in all browsers. Good job, guys, thank you for saving me from lots of senseless sweats!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2008/09/clearfix-problem-and-solution-for-ff-and-ie-incluing-ie7/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>:hover</title>
		<link>http://blog.templatix.org/2008/09/hover/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hover</link>
		<comments>http://blog.templatix.org/2008/09/hover/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 20:51:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=34</guid>
		<description><![CDATA[SIMPLY PUT: menu with submenus, CSS-only (no JS) Any modern browser (implicitely excluding all versions of IE), if is playing by the CSS book, has support for the dynamic pseudo-class &#8220;:hover&#8221; on ALL tags, not just on the lonely sad pathetic &#60; a &#62;. Note: As you may already know, in CSS there&#8217;s a series [...]]]></description>
			<content:encoded><![CDATA[<p><strong>SIMPLY PUT: menu with submenus, CSS-only (no JS)</strong></p>
<p>Any modern browser (implicitely excluding all versions of IE), if is playing by the CSS book, has support for the <a title="Dynamic Pseudo-classes  on W3C" href="http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes" target="_blank">dynamic pseudo-class</a> &#8220;<strong>:hover</strong>&#8221; on ALL tags, not just on the lonely sad pathetic <strong>&lt; a &gt;</strong>.</p>
<blockquote><p>Note: As you may already know, in CSS there&#8217;s a series of dynamic pseudo-classes (:hover, :active si :focus) that traditionally get associated with &#8220;a&#8221; in order to create different styles for the 3 possible different states of a link, as in <strong>a:hover</strong>, for instance.</p></blockquote>
<p>Modern browsers, as I was saying, having implemented the support for this, allow for the association of the pseudo-classes with any HTML tag. In other words, you could very well define something like:</p>
<pre>td       {background-color: #cccccc;}
td:hover {background-color: #336699;}</pre>
<p>which would result in a background-color change on those td-s, on roll-over, without any need whatsoever to use HTML-bloating javascript code.</p>
<p><span id="more-34"></span>Pretty neat, huh? It&#8217;s an excellent feature, supported now even by the overly-and-yet-not-enough-booed IE7. Only the older IEs still go around butt-naked&#8230; So my recommendation is that you follow both the tutorial and the linked examples in a _modern_ browser.</p>
<p>Well, moving on with the tutorial, let&#8217;s see just what could we use this pretty thing for: Let&#8217;s imagine for a minute that we want to keep an HTML element hidden, making it visible only when we mouse-hover it&#8217;s parent. It&#8217;s an overly-known scenario for anybody who ever tried to build menus with sub-menus. To give you an example, I&#8217;ll just go back to a &lt; li &gt; case:</p>
<pre>&lt;ul id="menu"&gt;
  &lt;li&gt;&lt;a href="#"&gt;Element 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Element 2&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Element 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>This would be a classical, simple menu (I gave it an &#8220;id&#8221; for a simple reason: to be able to better controll the way in which to apply the CSSs later &#8211; in other words, if I have multiple ULs in the document and I want to restrict the behaviors to only THIS one, then I just restrict from the very begining how I apply the redefinition of the ULs and LIs in the CSS).</p>
<p>Let&#8217;s say we want to enrigh it a bit wit some second-level elements, by means of &#8211; yes, again &#8211; &lt; ul &gt; with &lt; li &gt; -s:</p>
<pre>&lt;ul id="menu"&gt;
  &lt;li&gt;&lt;a href="#"&gt;Element 1&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 1&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 2&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 3&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Element 1&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 1&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 2&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 3&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Element 1&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 1&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 2&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sub-element 3&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;</pre>
<p>(You can check out what we&#8217;ve got so far, <a title=":hover - phase 1" href="http://blog.templatix.org/wp-content/uploads/2007/02/hover_1.html" target="_blank">here</a>).<br />
Let&#8217;s try and style it a bit, now! First of all I&#8217;ll want any &lt; ul &gt; found in the &lt; ul &gt; marked by the id=&#8221;menu&#8221; to be hidden:</p>
<pre>#menu ul {display: none;}</pre>
<blockquote><p>Note: Why use, for <strong>display</strong>, the value<strong>none</strong> and not <strong>hidden</strong>? Because any HTML element has two inherent properties: the <strong>visibility</strong> and the <strong>occupied space</strong>. While <strong>hidden</strong> only affects the visibility (like a sort of transparency: you can&#8217;t see the object, byt the space it occupied remains fermly on position), <strong>none</strong> affects both properties, both hiding the object and freeing up the space it occupied.</p></blockquote>
<p>Now that I&#8217;ve hidden the secondary menus, I want it to get back when I mouse-hover it&#8217;s containing &lt; li &gt;:</p>
<pre>li:hover ul {display: block;}</pre>
<p>(in other words: any <strong>UL</strong> found in a <strong>mouse-hovered LI</strong> will be displayed as a  <strong>block</strong>)<br />
As you can see <a title=":hover - phase 2" href="http://blog.templatix.org/wp-content/uploads/2007/02/hover_2.html" target="_blank">here</a>, we haven&#8217;t solved much, although logic tells you we should&#8217;ve.</p>
<blockquote><p>WHY: every CSS rule has a precise <a title="!important;" href="http://blog.templatix.org/2008/09/important/" target="_blank">importance</a>, that you can calculate simply by counting the elements that define it. And every element has in turn a predefined value, depending on what kind of element it is. A simple node (<strong>.my_class</strong> for instance) values <strong>1</strong>, a pseudo-class (a <strong>:hover</strong> for instance) values <strong>10</strong>, and an id (<strong>#class_x</strong> for instance) values <strong>100</strong>. (wow that&#8217;s a lot of theory right there! <img src='http://blog.templatix.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p></blockquote>
<p>Now if we count the 2 rules above, for the first one we have <strong>#menu ul</strong> (100+1=<strong>101</strong>) and for the second one we have <strong>li:hover ul</strong> (10+1=<strong>11</strong>). From this simple math you can now understand how come that a &#8220;more general&#8221; rule can be out-smarted by a &#8220;more private&#8221; one, even when logics and common-sense tell you the opposite. What can be done? Simply: increase the &#8220;value&#8221; of the second rule:</p>
<pre>#menu li:hover ul {display: block;}</pre>
<p>Now we have <strong>#menu li:hover ul</strong> (100+10+1=<strong>111&gt;101</strong>), which solves the problem (see the result <a title=":hover - phase 3" href="http://blog.templatix.org/wp-content/uploads/2007/02/hover_3.html" target="_blank">here</a>).</p>
<p>If we further add some more styling to spice things up a bit,</p>
<pre>#menu   {width: 10em;}
ul      {margin: 0px; padding: 0px;}
ul ul   {padding-left: 10px;}
li      {list-style-type: none;}
#menu a {display: block; margin: 0; padding: 2px 3px;}
a       {background-color: #CCCCCC; text-decoration: none;
        font-family: Verdana; font-size: 11px;}
a:hover {background-color: #EAEAEA;}</pre>
<p>we get <a title=":hover - phase 4" href="http://blog.templatix.org/wp-content/uploads/2007/02/hover_4.html" target="_blank">something</a> that really starts to look like a menu. And all this, WITHOUT ANY JAVASCRIPT, with a simple, clean code that, when needed, degrades gracefully, clearly and in a structured manner in any more limited browser, so it&#8217;s easy to use in virtually any environment. From here on (for this example) your imagination in making it look pretty is the only limit.</p>
<p><strong>IE5/6? </strong></p>
<p>These two retarded browsers won&#8217;t EVER understand what we&#8217;ve been talking about so far. It&#8217;s by sheer dumb luck that the gentlemen at M$ allowed us to redefine the way some HTML tags work by using sets of rules in <strong>.htc</strong> files. Since this is a completely different story, I&#8217;m just going to send you reading what others, wiser guys, have to say about this, <a href="http://www.xs4all.nl/~peterned/csshover.html" target="_blank">here</a>, that&#8217;s IF you have the patience I HAD. The Bottom-line is that the guys from the above link have programmed such an .htc file that suits our :hover needs like a glove, emulating for IE5/6 around 99% from <strong>:hover</strong>&#8216;s behaviour..</p>
<p>In order to make our example work in IE5/6, you&#8217;ll just have to download the file from <a href="http://www.xs4all.nl/~peterned/htc/csshover2.htc" target="_blank">here</a> and to save it in the same folder with the CSS file, then to use conditional comments to force IE (and not only it) to &#8220;read&#8221; some extra stuff, like so:</p>
<pre>&lt;!--[if IE]&gt;
&lt;style type="text/css" media="screen"&gt;
body          {behavior: url(csshover.htc); font-size: 100%;}
&lt;/style&gt;
&lt;![endif]--&gt;</pre>
<p>(we&#8217;re just teaching the &#8220;body&#8221; tag to play by the <strong>behavior: url(csshover.htc);</strong> rules) Since IE will be the only one to understand this crap, other browsers won&#8217;t be affected and we&#8217;ll have gotten exactly what we came for. And, since all thiss crap is inside a comment, it will validate just fine <img src='http://blog.templatix.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  which will work for us again.</p>
<p>Clearly, the list of cross-browser compatibility problems doesn&#8217;t stop here&#8230; So both IE7 and IE5/6 will just mess up our menu, if we tray to make it look at least decent.</p>
<p>The way around this? Yet another &#8220;hack&#8221; from M$ &#8211; the possibility to create CSS definitions conditionally, depending on the detected browser. After some tweaking I got the following set of conditional rule, both for IE7 and for IE5/6:</p>
<pre>&lt;!--[if IE]&gt;
&lt;style type="text/css" media="screen"&gt;
body        {behavior: url(csshover.htc);}
#menu ul li {float: left; width: 100%;}
li          {border-bottom: solid 1px #CCCCCC; margin-bottom: -1px;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;!--[if gte IE 7]&gt;
&lt;style type="text/css" media="screen"&gt;
#menu ul li {float: none;}
li          {border-bottom: none 0px; margin-bottom: -4px;}
&lt;/style&gt;
&lt;![endif]--&gt;</pre>
<p>The final file can be seen <a title=":hover - phase 5" href="http://blog.templatix.org/wp-content/uploads/2007/02/hover_5.html" target="_blank">here</a>.<br />
For inspiration, read what <a title="CSS Down Menus - Horizontal and Vertical" href="http://www.tanfa.co.uk/css/examples/css-dropdown-menus.asp" target="_blank">I have read</a> too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2008/09/hover/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Hexagons</title>
		<link>http://blog.templatix.org/2008/09/css-hexagons/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-hexagons</link>
		<comments>http://blog.templatix.org/2008/09/css-hexagons/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 19:56:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=28</guid>
		<description><![CDATA[For the sleepless&#8230; a page built exclusively with CSS&#8230; even though it doesn&#8217;t look like html&#8230; guess how they did it.]]></description>
			<content:encoded><![CDATA[<p>For the sleepless&#8230; a page built exclusively with <a href="http://tantek.com/map.html" target="_blank">CSS</a>&#8230; even though it doesn&#8217;t look like html&#8230; guess how they did it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2008/09/css-hexagons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>modi v2 (MouseOver DOM Inspector)</title>
		<link>http://blog.templatix.org/2008/09/modi-v2-mouseover-dom-inspector/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=modi-v2-mouseover-dom-inspector</link>
		<comments>http://blog.templatix.org/2008/09/modi-v2-mouseover-dom-inspector/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 19:48:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=26</guid>
		<description><![CDATA[For those using Firefoxe&#8217;s Firebug, inspecting DOM elements is already a breeze. But what about Internet Explorer? The guys at slayeroffice have created a new DOM inspector that works on any browser, which is easy to install, by simply bookmarking it. It&#8217;s not as advanced as the Firebug, but it can prove extremely useful sometimes. [...]]]></description>
			<content:encoded><![CDATA[<p>For those using Firefoxe&#8217;s Firebug, inspecting DOM elements is already a breeze. But what about Internet Explorer? The guys at  slayeroffice have created a new DOM inspector that works on any browser, which is easy to install, by simply bookmarking it. It&#8217;s not as advanced as the Firebug, but it can prove extremely useful sometimes. <a href="http://slayeroffice.com/tools/modi/v2.0/modi_help.html" target="_blank">See here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2008/09/modi-v2-mouseover-dom-inspector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expandable Menu &#8211; JS + CSS</title>
		<link>http://blog.templatix.org/2008/09/expandable-menu-js-css/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=expandable-menu-js-css</link>
		<comments>http://blog.templatix.org/2008/09/expandable-menu-js-css/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 19:46:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=23</guid>
		<description><![CDATA[&#8230;or &#8220;Building An Expanding DHTML Menu With CSS and JavaScript &#8211; revisited&#8221;. What&#8217;s this all about: a vertical menu with submenus which are hidden initially and show on rollover. Requests: 1. On roll-over over a zero-level element, the corresponding sub-menu must appear 2. On roll-over over another zero-level element, besides the effect from point 1. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.templatix.org/wp-content/uploads/2007/02/tutorial_10.gif" alt="tutorial_10.gif" align="left" hspace="10" />&#8230;or &#8220;<a href="http://www.interspire.com/content/articles/10/1/Building-An-Expanding-DHTML-Menu-With-CSS-and-JavaScript" target="_blank">Building An Expanding DHTML Menu With CSS and JavaScript</a> &#8211; revisited&#8221;.</p>
<p>What&#8217;s this all about: a vertical menu with submenus which are hidden initially and show on rollover.</p>
<p>Requests:</p>
<p>1. On roll-over over a zero-level element, the corresponding sub-menu must appear<br />
2. On roll-over over another zero-level element, besides the effect from point 1. any other secondary menu must hide, only the the submenu corresponding to the active roll-over must remain visible</p>
<p>The most elegant solution I found is in the page linked at the beginning of the article, but it was a bit too long for what I needed, so I took it, adapted it, and I got exactly what I need (see <a href="http://blog.templatix.org/wp-content/uploads/2007/02/meniu_expandabil_js_css.html" title="Meniu expandabil JS + CSS" target="_blank">here</a> a functioning example, with all it needs to understand it, if you look in the source).</p>
<p><em>Later edit</em>: for a more elegant menu version (in terms of coding and approach), but less functional and without JS, read <a href="http://graffiti.hbfx.com/?p=69">here</a> (in Romanian).</p>
<p>Versiunea in Romana a acestui articol <a href="http://graffiti.hbfx.com/?p=169">aici</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2008/09/expandable-menu-js-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>min-height, min-width in all browsers</title>
		<link>http://blog.templatix.org/2008/09/min-height-min-width-in-all-browsers/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=min-height-min-width-in-all-browsers</link>
		<comments>http://blog.templatix.org/2008/09/min-height-min-width-in-all-browsers/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 18:44:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.templatix.org/?p=11</guid>
		<description><![CDATA[I wrote, some time ago, about how to solve this problem with min or max dimensions in more retarder browsers. The solution proposed was to use conditional javascript expressions inside the CSS file. Not very elegant, and quite limited. Meanwhile I found a much simpler, more elegant and better validating solution. Let&#8217;s say we want [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote, some time ago, about how to solve this <a href="http://graffiti.hbfx.com/?p=75">problem with min or max dimensions in more retarder browsers</a>.</p>
<p>The solution proposed was to use conditional javascript expressions inside the CSS file. Not very elegant, and quite limited.</p>
<p>Meanwhile I found a much simpler, more elegant and better validating solution. Let&#8217;s say we want to get a min-height of 400px. How do we go about it? Easy enough, we use 3 CSS properties instead of just one, like so::</p>
<pre>min-height: 400px;
height: 400px;
height: auto !important;</pre>
<p>And, miracle! It works! In every browser that I always test against: IE6, IE7, FF, Opera, Safari. Enjoy&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.templatix.org/2008/09/min-height-min-width-in-all-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

