<?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>Eric Wendelin&#039;s Blog &#187; CSS</title>
	<atom:link href="http://eriwen.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://eriwen.com</link>
	<description>Programming productively with open-source tools</description>
	<lastBuildDate>Tue, 31 Jan 2012 14:30:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>A CSS-only speech bubble</title>
		<link>http://eriwen.com/css/speech-bubble/</link>
		<comments>http://eriwen.com/css/speech-bubble/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 11:00:09 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=988</guid>
		<description><![CDATA[I generally try to avoid using images or Javascript when I can accomplish good presentation with CSS. In this case, I wanted to apply <a href="http://www.howtocreate.co.uk/tutorials/css/slopes" title="CSS tutorial - Using borders to produce angled shapes">CSS shapes</a> to make a clever speech bubble. 

<h2>The problem with obtuse triangles and CSS</h2>
<a href="http://mathworld.wolfram.com/ObtuseTriangle.html">Obtuse triangles</a> are slightly more complicated, since you can only create acute and right triangles with the CSS shapes method linked above. Therefore I created two triangles: a positive (black) right triangle, and then a negative (white) triangle to emulate an obtuse triangle.
 <a href="http://eriwen.com/css/speech-bubble/">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://eriwen.com/css/color-palette-with-css-and-moo/' rel='bookmark' title='Create a Color Palette Using CSS and MooTools 1.2'>Create a Color Palette Using CSS and MooTools 1.2</a></li>
<li><a href='http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/' rel='bookmark' title='Use the table-layout CSS property to speed up table rendering'>Use the table-layout CSS property to speed up table rendering</a></li>
<li><a href='http://eriwen.com/css/css-indirect-adjacent-combinator/' rel='bookmark' title='About the indirect adjacent combinator (~) in CSS'>About the indirect adjacent combinator (~) in CSS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I generally try to avoid using images or Javascript when I can accomplish good presentation with CSS. In this case, I wanted to apply <a href="http://www.howtocreate.co.uk/tutorials/css/slopes" title="CSS tutorial - Using borders to produce angled shapes">CSS shapes</a> to make a clever speech bubble. </p>
<h2>The problem with obtuse triangles and CSS</h2>
<p><a href="http://mathworld.wolfram.com/ObtuseTriangle.html">Obtuse triangles</a> are slightly more complicated, since you can only create acute and right triangles with the CSS shapes method linked above. Therefore I created two triangles: a positive (black) right triangle, and then a negative (white) triangle to emulate an obtuse triangle.</p>
<h2>The HTML</h2>
<pre class="brush: xml; light: true; title: ; notranslate">
&lt;blockquote id=&quot;bubble&quot;&gt;
    &lt;!-- Black (positive) triangle --&gt;
    &lt;span class=&quot;arrow&quot;&gt;
        &lt;!-- White (negative) triangle --&gt;
        &lt;span&gt; &lt;/span&gt;
    &lt;/span&gt;
    Content inside bubble
&lt;/blockquote&gt;
</pre>
<p>Any tag combination will work as long as the CSS shape elements are <em>inline</em> elements. </p>
<h2>The CSS</h2>
<p>The two key parts of the CSS are the rounded corners (available in major, non-IE browsers) and the arrow that extends from the bubble. </p>
<pre class="brush: css; title: ; notranslate">
#bubble {
    margin: 8px 0;
    padding: 10px;
    position: relative;
  /* Adjust these to taste */
    width: 175px;
    border: 2px solid #000;
    -moz-border-radius: 15px;
    -webkit-border-radius: 15px;
    border-radius: 15px; /* Opera and Chrome */
}
#bubble .arrow {
    border-bottom: 0px solid #FFF;
    border-right: 20px solid #000;
    border-top: 15px solid #FFF;
    position: absolute;
    left: -20px;
    top: 5px;
    height: 0;
    width: 0;
    line-height: 0;
}
#bubble .arrow span {
    border-bottom: 0px solid transparent;
    border-right: 20px solid #FFF;
    border-top: 8px solid transparent;
    width: 0;
    height: 0;
    line-height: 0;
    position: absolute;
    left: -2px;
    top: -8px;
}
</pre>
<p>After all this, we have:</p>
<p><img src="http://eriwen-cdn.s3.amazonaws.com/images/bubble.png" alt="CSS Bubble image" style="display: block; margin: 0 auto;" /></p>
<p>I haven&#8217;t done so here, but you can can create more interesting elliptical borders with:</p>
<pre class="brush: css; light: true; title: ; notranslate">
    padding: 25px; /* &lt;- increase padding to avoid text overlap of the ellipse */
  /* attribute: width / height */
    -moz-border-radius: 60px / 15px;
    -webkit-border-radius: 60px / 15px;
    border-radius: 60px / 15px;
</pre>
<p>Note that Opera uses <em>border-radius</em> and that Safari/Chrome does not support percentages. I know this doesn&#8217;t look as pretty in IE, but it&#8217;s a neat &#8220;progressive enhancement&#8221;. This might be a great idea for comments, twitter statuses or sub-headings.</p>
<p>There probably is a clever way to inherit a transparent color from a parent element, but I didn&#8217;t really take the time to dig into it. If you have improvements, I&#8217;d love to hear them.</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/css/color-palette-with-css-and-moo/' rel='bookmark' title='Create a Color Palette Using CSS and MooTools 1.2'>Create a Color Palette Using CSS and MooTools 1.2</a></li>
<li><a href='http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/' rel='bookmark' title='Use the table-layout CSS property to speed up table rendering'>Use the table-layout CSS property to speed up table rendering</a></li>
<li><a href='http://eriwen.com/css/css-indirect-adjacent-combinator/' rel='bookmark' title='About the indirect adjacent combinator (~) in CSS'>About the indirect adjacent combinator (~) in CSS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/speech-bubble/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>About the indirect adjacent combinator (~) in CSS</title>
		<link>http://eriwen.com/css/css-indirect-adjacent-combinator/</link>
		<comments>http://eriwen.com/css/css-indirect-adjacent-combinator/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 23:28:36 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=57</guid>
		<description><![CDATA[<img alt="CSS Indirect Adjacent Combinator" src="http://static.eriwen.com/images/tilde.png" style="float: right; margin: 0px 0px 4px 8px;" />A relative of the <a href="http://eriwen.com/css/css-adjacent-sibling-selectors/">CSS Adjacent Sibling Combinator</a> that I wrote about before, the <em>indirect</em> adjacent combinator is pretty nifty and <strong>supported by IE7+, FF2+, Opera 9.5+, Safari 3+, and even Konqueror.</strong> It is actually part of the CSS3 spec but it's surprisingly well supported. <a href="http://eriwen.com/css/css-indirect-adjacent-combinator/">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://eriwen.com/css/css-adjacent-sibling-selectors/' rel='bookmark' title='CSS Adjacent Sibling Selectors'>CSS Adjacent Sibling Selectors</a></li>
<li><a href='http://eriwen.com/css/color-palette-with-css-and-moo/' rel='bookmark' title='Create a Color Palette Using CSS and MooTools 1.2'>Create a Color Palette Using CSS and MooTools 1.2</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Similar to the <a href="http://eriwen.com/css/css-adjacent-sibling-selectors/">CSS Adjacent Sibling Combinator</a> that I wrote about before, the <em>indirect</em> adjacent combinator is pretty nifty and <strong>supported by IE7+, FF2+, Opera 9.5+, Safari 3+, and even Konqueror.</strong> It is actually part of the CSS3 spec but it&#8217;s surprisingly well supported. Here&#8217;s how to use it and what it does:</p>
<h2>Using the CSS Indirect Adjacent Combinator</h2>
<pre class="brush: css; light: true; title: ; notranslate">
h3 ~ p {
  color: #FFFFFF;
  padding-left: 20px;
  border-left: 3px solid;
}
</pre>
<p><img alt="CSS Indirect Adjacent Combinator" src="http://static.eriwen.com/images/tilde.png" style="float: left; margin: 0px 8px 4px 0px;"/>This would affect each &lt;p&gt; element that is a sibling of a preceding &lt;h3&gt; element. This is different from the Adjacent Sibling Combinator (+) in that it <strong>affects all following &lt;p&gt; siblings instead of just the immediate sibling</strong>. Let us see an example:</p>
<h2>CSS Indirect Adjacent example</h2>
<style type="text/css">
#indirect-example1 h4 + p, #indirect-example2 h4 ~ p { background-color: #CCC; color: #F00; }
</style>
<div id="indirect-example1">
<p>Example 1: Adjacent Sibling combinator (h4 + p) test:</p>
<h4>Heading 4</h4>
<p>Paragraph 1 &#8211; This should be gray and red</p>
<p>Paragraph 2 &#8211; This should NOT be red</p>
</div>
<div id="indirect-example2">
<p>Example 2: <em>Indirect</em> Adjacent Sibling combinator (h4 ~ p) test:</p>
<h4>Heading 4</h4>
<p>Paragraph 1 &#8211; This should be gray and red</p>
<p>Paragraph 2 &#8211; This should also be gray and red!!</p>
</div>
<p>Here is the CSS for the above example:</p>
<pre class="brush: css; light: true; title: ; notranslate">
#indirect-example1 h4 + p,
#indirect-example2 h4 ~ p {
    background-color: #CCC; color: #F00;
}
</pre>
<p>Cool, right? So you see how you can use this instead of the (+) selector to apply styles to the elements you want in basically everything except IE6-! This is a good example of something used for <em>progressive enhancement</em> that should be used to add detail to elements to give your users more information.</p>
<p class="update">Update: Sorry for the name confusion. The <a href="http://www.w3.org/TR/css3-selectors/#general-sibling-combinators">latest draft of the CSS3 spec</a> calls this the &quot;General Sibling Combinator&quot; and I didn&#8217;t think it had changed from &quot;Indirect Adjacent Combinator&quot; when I first learned of it so I used the latter. My apologies!</p>
<p>Have you ever used this? What was your experience and what ideas do you have for this CSS gem?</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/css/css-adjacent-sibling-selectors/' rel='bookmark' title='CSS Adjacent Sibling Selectors'>CSS Adjacent Sibling Selectors</a></li>
<li><a href='http://eriwen.com/css/color-palette-with-css-and-moo/' rel='bookmark' title='Create a Color Palette Using CSS and MooTools 1.2'>Create a Color Palette Using CSS and MooTools 1.2</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/css-indirect-adjacent-combinator/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Next major Firefox 3 release will support almost all of CSS3</title>
		<link>http://eriwen.com/css/next-firefox-3-release-support-css3/</link>
		<comments>http://eriwen.com/css/next-firefox-3-release-support-css3/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 15:07:55 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Firefox CSS3]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=55</guid>
		<description><![CDATA[It looks like <a href="http://dbaron.org/log/">David Baron</a> is working hard on new CSS support for Firefox 3. His latest blog post tells us that he has finished up support for a bunch of CSS3 selectors, available now in the <a href="http://www.mozilla.org/developer/#builds">Firefox nightly build</a>:

<blockquote>We now support :nth-child(), :nth-last-child(), :nth-of-type(), and :nth-last-of-type() [...] :first-of-type, :last-of-type, and :only-of-type</blockquote>

This will be released with the next major version of 'fox (probably 3.1). It looks like support for<a href="http://www.w3.org/TR/css3-mediaqueries/">Media Queries</a> is next. Hurrah! Good work David! <a href="http://eriwen.com/css/next-firefox-3-release-support-css3/">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://eriwen.com/firefox/firefox-3-chrome-tweaks/' rel='bookmark' title='Early Adopters: Your Firefox 3 chrome tweaks are HERE'>Early Adopters: Your Firefox 3 chrome tweaks are HERE</a></li>
<li><a href='http://eriwen.com/firefox/use-the-dom-inspector/' rel='bookmark' title='How to use the DOM Inspector to hack your Firefox UI'>How to use the DOM Inspector to hack your Firefox UI</a></li>
<li><a href='http://eriwen.com/firefox/firefox-3-aboutconfig-hacks/' rel='bookmark' title='Cutting Edge: Exclusive Firefox 3 about:config hacks'>Cutting Edge: Exclusive Firefox 3 about:config hacks</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p class="update">Author&#8217;s note: <a href="http://www.broken-links.com/">Peter Gasston</a> and I kindly remind readers that the CSS3 spec is far from finished, so note that I mean all of the current (as of June 2008) CSS3 selectors.</p>
<p>It looks like <a href="http://dbaron.org/log/">David Baron</a> is working hard on new CSS support for Firefox 3. His latest blog post tells us that he has finished up support for a bunch of CSS3 selectors, available now in the <a href="http://www.mozilla.org/developer/#builds">Firefox nightly build</a>:</p>
<blockquote><p>We now support :nth-child(), :nth-last-child(), :nth-of-type(), and :nth-last-of-type() (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=75375">bug report</a>) and :first-of-type, :last-of-type, and :only-of-type (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=128585">bug report</a>)</p></blockquote>
<p>This will be released with the next major version of &#8216;fox (probably 3.1). It looks like support for <a href="http://www.w3.org/TR/css3-mediaqueries/">Media Queries</a> is next. Hurrah! Good work David!</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/firefox/firefox-3-chrome-tweaks/' rel='bookmark' title='Early Adopters: Your Firefox 3 chrome tweaks are HERE'>Early Adopters: Your Firefox 3 chrome tweaks are HERE</a></li>
<li><a href='http://eriwen.com/firefox/use-the-dom-inspector/' rel='bookmark' title='How to use the DOM Inspector to hack your Firefox UI'>How to use the DOM Inspector to hack your Firefox UI</a></li>
<li><a href='http://eriwen.com/firefox/firefox-3-aboutconfig-hacks/' rel='bookmark' title='Cutting Edge: Exclusive Firefox 3 about:config hacks'>Cutting Edge: Exclusive Firefox 3 about:config hacks</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/next-firefox-3-release-support-css3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Create a Color Palette Using CSS and MooTools 1.2</title>
		<link>http://eriwen.com/css/color-palette-with-css-and-moo/</link>
		<comments>http://eriwen.com/css/color-palette-with-css-and-moo/#comments</comments>
		<pubDate>Thu, 15 May 2008 07:00:54 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Guest]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=50</guid>
		<description><![CDATA[<p class="update">This entry was authored by highly-respected blogger and friend <a href="http://davidwalsh.name" target="_blank">David Walsh</a>. <a href="http://eriwen.com/css/color-palette-with-css-and-moo/#bio-david">Learn more about David</a></p>
<p>As you can see from my site's <span style="text-decoration: line-through;">lack of</span> design (<a href="http://davidwalsh.name/" target="_blank">davidwalsh.name</a>), I'm about 90% programmer and 10% designer.  As someone that's not a designer, I'm really grateful for websites like <a href="http://www.colourlovers.com/" target="_blank">ColourLovers</a> -- websites that provide you palettes of colors that look good together.  Let's pretend for a moment that I do have a good design and I want others to know my palette.  MooTools 1.2 has made that a reality.</p>
<p><a href="http://davidwalsh.name/dw-content/color-palette.php" target="_blank"><img src="http://davidwalsh.name/dw-content/palette.jpg" alt="" /></a></p> <a href="http://eriwen.com/css/color-palette-with-css-and-moo/">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://eriwen.com/javascript/text-size-prefs/' rel='bookmark' title='Guest Post: Save Text Size Preference Using MooTools and PHP'>Guest Post: Save Text Size Preference Using MooTools and PHP</a></li>
<li><a href='http://eriwen.com/css/speech-bubble/' rel='bookmark' title='A CSS-only speech bubble'>A CSS-only speech bubble</a></li>
<li><a href='http://eriwen.com/css/css-indirect-adjacent-combinator/' rel='bookmark' title='About the indirect adjacent combinator (~) in CSS'>About the indirect adjacent combinator (~) in CSS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p class="update">This entry was authored by highly-respected blogger and friend <a href="http://davidwalsh.name" target="_blank">David Walsh</a>. <a href="http://eriwen.com/css/color-palette-with-css-and-moo/#bio-david">Learn more about David</a></p>
<p>As you can see from my site&#8217;s <span style="text-decoration: line-through;">lack of</span> design (<a href="http://davidwalsh.name/" target="_blank">davidwalsh.name</a>), I&#8217;m about 90% programmer and 10% designer.  As someone that&#8217;s not a designer, I&#8217;m really grateful for websites like <a href="http://www.colourlovers.com/" target="_blank">ColourLovers</a> &#8212; websites that provide you palettes of colors that look good together.  Let&#8217;s pretend for a moment that I do have a good design and I want others to know my palette.  MooTools 1.2 has made that a reality.</p>
<p><a href="http://davidwalsh.name/dw-content/color-palette.php" target="_blank"><img src="http://davidwalsh.name/dw-content/palette.jpg" alt="" /></a></p>
<h2>Step 1: The XHTML</h2>
<pre class="brush: xml; title: ; notranslate">
&lt;input type=&quot;button&quot; id=&quot;get-colors&quot; value=&quot;Get Colors&quot; class=&quot;button&quot; /&gt;
&lt;div id=&quot;colors-wrapper&quot;&gt;&lt;/div&gt;
</pre>
<p>I&#8217;ve created two elements to begin with:  a DIV that will serve as a wrapper for the color palette and a button that will trigger the color palette&#8217;s creation.</p>
<h2>Step 2: The CSS</h2>
<pre class="brush: css; title: ; notranslate">
.dcolor { height:40px; }
.dtext {  }
.dwrapper { width:100px; float:left; padding:10px; margin:0 20px 20px 0; border:1px solid #ccc; }
</pre>
<p>The above CSS simply formats the elements that are needed to create the palette.</p>
<h2>Step 3: The Moo 1.2 Javascript</h2>
<pre class="brush: jscript; title: ; notranslate">
//once the dom is ready
window.addEvent('domready', function() {

	//do it!
	$('get-colors').addEvent('click', function() {
		//starting the colors array
		var colors = [];
		var disallows = ['transparent'];

		//for every element
		$$('*').each(function(el) {
			//record colors!
			colors.include(el.getStyle('color'));
			colors.include(el.getStyle('background-color'));
			el.getStyle('border-color').split(' ').each(function(c) {
				colors.include(c);
			});
		});

		//sort the colors
		colors.sort();

		//empty wrapper
		$('colors-wrapper').empty();

		//for every color...
		colors.each(function(val,i) {

			//if it's good
			if(!disallows.contains(val))
			{
				//create wrapper div
				var wrapper = new Element('div', {
					'class':'dwrapper'
				});

				//create color div, inject
				var colorer = new Element('div', {
					'class':'dcolor',
					'style': 'background:' + val
				});
				colorer.inject(wrapper);

				//alert(val);

				//create text div, inject
				var texter = new Element('div', {
					'class':'dtext',
					'text':val
				});
				texter.inject(wrapper);

				//inject wrapper
				wrapper.inject($('colors-wrapper'));
			}
		});
	});
});
</pre>
<p>Once the DOM is ready, we start listening for a click on our &#8220;Get Colors&#8221; button.  When the button is clicked, we store every element&#8217;s background color, border color, and text color.  Once we have every color in our array, we sort the array and clear the wrapper DIV.  For every color we&#8217;ve found, we create a DIV that displays the color and it&#8217;s hex value.  That&#8217;s it!</p>
<p>The result?  A sweet javascript script giving you a color palette of the current page.  <a href="http://davidwalsh.name/dw-content/color-palette.php" target="_blank">Click here to build a color palette</a> of my example page!</p>
<p><em>Note: This script doesn&#8217;t accommodate images.</em></p>
<p><a name="bio-david" /></p>
<p class="bio"><img src="http://eriwen.com/images/david-walsh.gif" alt="David Walsh" style="float: left; margin: 0px 8px 4px 0px;" /><a href="http://davidwalsh.name" target="_blank">David Walsh</a> is a Senior Web Developer residing in Madison, WI. He spends most of his day getting a monitor tan coding PHP, CSS, MooTools, and XHTML. When not tinkering with the newest version of <a href="http://mootools.net" target="_blank">Moo</a>, David uses soccer, Rock Band, and movies to dull his coding pains.</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/text-size-prefs/' rel='bookmark' title='Guest Post: Save Text Size Preference Using MooTools and PHP'>Guest Post: Save Text Size Preference Using MooTools and PHP</a></li>
<li><a href='http://eriwen.com/css/speech-bubble/' rel='bookmark' title='A CSS-only speech bubble'>A CSS-only speech bubble</a></li>
<li><a href='http://eriwen.com/css/css-indirect-adjacent-combinator/' rel='bookmark' title='About the indirect adjacent combinator (~) in CSS'>About the indirect adjacent combinator (~) in CSS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/color-palette-with-css-and-moo/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Use the table-layout CSS property to speed up table rendering</title>
		<link>http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/</link>
		<comments>http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 05:21:26 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/</guid>
		<description><![CDATA[A rarely used <abbr title="Cascading Style Sheets">CSS</abbr> property that can be very useful given the right circumstances is the <em>table-layout</em> property. It has great rendering speed benefit when used properly. Obviously this will only apply to <abbr title="HyperText Markup Language">HTML</abbr> &#60;table&#62;s, which I know none of you would EVER overuse. Tables are not totally evil, they have their proper implementations and their really, really bad ones. OK, on to the code:
 <a href="http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://eriwen.com/firefox/editing-layout-in-firebug/' rel='bookmark' title='Quick Tip: Editing layout in Firebug'>Quick Tip: Editing layout in Firebug</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/productivity/aliases-and-functions/' rel='bookmark' title='Using aliases and command-line functions for speed'>Using aliases and command-line functions for speed</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A rarely used <abbr title="Cascading Style Sheets">CSS</abbr> property that can be very useful given the right circumstances is the <em>table-layout</em> property. It has great rendering speed benefit when used properly. Obviously this will only apply to <abbr title="HyperText Markup Language">HTML</abbr> &lt;table&gt;s, which I know none of you would EVER overuse. Tables are not totally evil, they have their proper implementations and their really, really bad ones. OK, on to the code:</p>
<pre class="brush: css; light: true; title: ; notranslate">
/* Set table to 'fixed' (fastest render) layout */
.fixed_table {
    table-layout: fixed;
}

/* Set table to 'auto' (best fit) layout. This is the default */
.auto_table {
    table-layout: auto;
}
</pre>
<p>Or alternatively in JavaScript:</p>
<pre class="brush: jscript; light: true; title: ; notranslate">
    $('elementID').style.tableLayout = 'fixed';
</pre>
<h2>When you want to use <em>table-layout: fixed</em></h2>
<p>So how fixed table layout works is that the browser <strong>looks at the first row of the table and determines how to render the table based on the table width and the columns but NOT on the content</strong> of the columns. This allows large tables to be rendered faster but risks the table not displaying &#8220;optimally&#8221;. The best place to use <em>table-layout: fixed</em> is on larger tables (probably &gt; 50 rows) and fairly uniform table cells (as in the cells should evenly divide the table). The benefit can be significant when the browser does not have to calculate the optimal width of each table cell.</p>
<h2>When you want to keep the default style <em>table-layout: auto</em></h2>
<p>There is almost no benefit to setting a small table to<em>table-layout: fixed</em>. Furthermore, if the cell content varies greatly in length, your table may look really funky and different browsers may display your table in quite odd ways. Let me show you what I mean. Here is a quick example:</p>
<table style="table-layout: fixed" border="1">
<caption>Fixed table-layout</caption>
<thead>
<tr>
<th>Header 1</th>
<th>Reallyreallyreallyreally looooong header</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Reallyyyyyyyyyy Looooooong cell conteeeent</td>
<td>short</td>
<td>Normal cell content</td>
</tr>
<tr>
<td>short</td>
<td>ReallyyyyyyyyyyLooooooong cell conteeeent</td>
<td>Normal cell content</td>
</tr>
</tbody>
</table>
<table style="table-layout: auto" border="1">
<caption>Auto table-layout</caption>
<thead>
<tr>
<th>Header 1</th>
<th>Reallyreallyreallyreally looooong header</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>ReallyyyyyyyyyyLooooooong cell conteeeent</td>
<td>short</td>
<td>Normal cell content</td>
</tr>
<tr>
<td>short</td>
<td>Reallyyyyyyyyyy Looooooong cell conteeeent</td>
<td>Normal cell content</td>
</tr>
</tbody>
</table>
<p>So don&#8217;t mess with <em>table-layout: auto</em> in these circumstances because it is just too unreliable. The harsh reality here with the automatic table layout is that the:</p>
<blockquote><p>algorithm is sometimes slow since it needs to access all the content in the table before determining the final layout</p></blockquote>
<p>This is why nesting or otherwise overusing &lt;table&gt;s is a bad idea.</p>
<p>For those interested, here is the <a href="http://www.w3.org/TR/CSS2/tables.html#propdef-table-layout">official spec</a> from the W3C. Have you ever used the <em>table-layout</em> <acronym title="Cascading Style Sheets">CSS</acronym> property? Was it useful and what was the result? Let&#8217;s hear it!</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/firefox/editing-layout-in-firebug/' rel='bookmark' title='Quick Tip: Editing layout in Firebug'>Quick Tip: Editing layout in Firebug</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/productivity/aliases-and-functions/' rel='bookmark' title='Using aliases and command-line functions for speed'>Using aliases and command-line functions for speed</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Personalize your Thunderbird by changing it&#8217;s chrome</title>
		<link>http://eriwen.com/css/tweaking-thunderbirds-chrome/</link>
		<comments>http://eriwen.com/css/tweaking-thunderbirds-chrome/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 06:57:07 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://eriwen.com/css/tweaking-thunderbirds-chrome/</guid>
		<description><![CDATA[<img src="http://static.eriwen.com/images/thunderbird-icon.png" alt="Thunderbird" style="margin: 0px 0px 5px 10px; float: right" />It's been awhile since we <a href="http://eriwen.com/firefox/howto-tweak-chrome-for-a-cleaner-firefox/" target="_blank">tweaked our Firefox chrome</a>, and it's about time we get to hack Mozilla's wonderful email client <a href="http://www.mozilla.com/en-US/thunderbird/" target="_blank">Thunderbird</a>.

In this post I'll give you the necessary tools to change the look of Thunderbird and give you some suggestions (and code, of course :) to help you along the way. First, let me give credit to <a href="http://www.twistermc.com/blog/2007/04/10/thunderbird-labels" target="_blank">Twister MC's wonderful post</a> that I will be using as a reference for the label coloring scripts below. OK, let's get started!

To start off we are going to need to setup our userChrome.css file for Thunderbird. <a href="http://www.mozilla.org/support/thunderbird/edit#css" target="_blank">Here are the instructions for that.</a> We just basically need to create a chrome directory in our Thunderbird profile with a userChrome.css file in it. Another note here is that you can create a Stylish script using the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/2108" target="_blank">Stylish Add-on for Thunderbird</a> and putting these <acronym title="Cascading Style Sheets">CSS</acronym> snippets in there. Does Stylish have any limitations here? Let me know in the comments if so.
 <a href="http://eriwen.com/css/tweaking-thunderbirds-chrome/">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://eriwen.com/thunderbird/jazz-up-thunderbird-tags/' rel='bookmark' title='Jazz up your new Thunderbird tags'>Jazz up your new Thunderbird tags</a></li>
<li><a href='http://eriwen.com/firefox/firefox-3-chrome-tweaks/' rel='bookmark' title='Early Adopters: Your Firefox 3 chrome tweaks are HERE'>Early Adopters: Your Firefox 3 chrome tweaks are HERE</a></li>
<li><a href='http://eriwen.com/firefox/howto-tweak-chrome-for-a-cleaner-firefox/' rel='bookmark' title='Tweak chrome for a cleaner Firefox'>Tweak chrome for a cleaner Firefox</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.eriwen.com/images/thunderbird-icon.png" alt="Thunderbird" style="margin: 0px 0px 5px 10px; float: right" />It&#8217;s been awhile since we <a href="http://eriwen.com/firefox/howto-tweak-chrome-for-a-cleaner-firefox/" target="_blank">tweaked our Firefox chrome</a>, and it&#8217;s about time we get to hack Mozilla&#8217;s wonderful email client <a href="http://www.mozilla.com/en-US/thunderbird/" target="_blank">Thunderbird</a>.</p>
<p>In this post I&#8217;ll give you the necessary tools to change the look of Thunderbird and give you some suggestions (and code, of course :) to help you along the way. First, let me give credit to <a href="http://www.twistermc.com/blog/2007/04/10/thunderbird-labels">Twister MC&#8217;s wonderful post</a> that I will be using as a reference for the label coloring scripts below. OK, let&#8217;s get started!</p>
<p>To start off we are going to need to setup our userChrome.css file for Thunderbird. <a href="http://www.mozilla.org/support/thunderbird/edit#css">Here are the instructions for that.</a> We just basically need to create a chrome directory in our Thunderbird profile with a userChrome.css file in it. Another note here is that you can create a Stylish script using the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/2108">Stylish Add-on for Thunderbird</a> and putting these <acronym title="Cascading Style Sheets">CSS</acronym> snippets in there. Does Stylish have any limitations here? Let me know in the comments if so.</p>
<p>Right! So open up your userChrome.css file in your favorite text editor (not Microsoft Word, I recommend <a href="http://www.jedit.org" target="blank">jEdit</a>) We&#8217;ll need to begin the file by defaulting to the XUL namespace:</p>
<pre class="brush: css; light: true; title: ; notranslate">
@namespace url(&quot;http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul&quot;);
/* set default namespace to XUL */
</pre>
<p>Then we get to the good stuff. Here are some snippets I have created for you to put in the userChrome.css file:</p>
<pre class="brush: css; light: true; title: ; notranslate">
/* Change menu and dialog font sizes */
menupopup &gt; * {
    font-size: 12px !important
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Change font-size of email list */
.tree-rows {
    font-size: 10px !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Change all fonts to Century Gothic */
* {
    font-family: &quot;Century Gothic&quot;, sans-serif !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Hide status bar */
#status-bar {
    display: none !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Get rid of the throbber */
#throbber-box {
    display: none !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Make Sidebar header big and bold */
#folderpane-title {
    font-size: 1.2em !important;
    font-weight: bold !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Hide Menus: menu_File, menu_Edit, menu_View, messageMenu, ltnCalendarMenu, tasksMenu */
#menu_File, #menu_Edit, #menu_View {
    display: none !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Remove disabled toolbar buttons until enabled */
toolbarbutton[disabled=&quot;true&quot;] {
    display: none !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Make unread messages blue and italic */
treechildren:-moz-tree-cell-text(unread) {
    color: #CCCCFF !important;
    font-style: italic !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Change background color of unread messages to slightly red */
treechildren::-moz-tree-cell(unread) {
    background-color: #330000 !important;
}
treechildren::-moz-tree-cell(unread,selected) {
    background-color: #660000 !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Change colors of replied messages */
treechildren::-moz-tree-cell(replied) {
    background-color: #003300 !important;
}
treechildren::-moz-tree-cell(replied,selected) {
    background-color: #006600 !important;
}
treechildren::-moz-tree-cell(replied,current) {
    background-color: #009900 !important;
}
treechildren:-moz-tree-cell-text(replied,current) {
    color: #FFFFFF !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Change color of deleted messages */
treechildren::-moz-tree-cell(imapdeleted) {
    background-color: #999999 !important;
}
treechildren:-moz-tree-cell-text(imapdeleted) {
    color: #FFFFFF !important;
text-decoration: line-through !important;
}
treechildren::-moz-tree-cell(imapdeleted,selected) {
    background-color: #333333 !important;
}
treechildren::-moz-tree-cell(imapdeleted,current) {
    background-color: #666666 !important;
}
treechildren:-moz-tree-cell-text(imapdeleted,selected) {
    color: #DDDDFF !important;
}
treechildren:-moz-tree-cell-text(imapdeleted,current) {
    color: #DDDDFF !important;
}
treechildren::-moz-tree-cell-text(imapdeleted, offline) {
    background-color: #DDDDDD !important;
    text-decoration: line-through !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Folder pane(color/text) and Message pane(color) */
treechildren {
    background-color: #2D2D2D !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* change Message Pane text */
treechildren:-moz-tree-cell-text(unread) {
    font-size: 10px !important;
    font-family: &quot;Times New Roman&quot; !important;
    font-weight: bold !important;
    color: #D50000 !important
}
treechildren:-moz-tree-cell-text(read) {
    font-size: 10px !important;
    font-family: &quot;Times New Roman&quot; !important;
    font-weight: bold !important;
}
</pre>
<pre class="brush: css; light: true; title: ; notranslate">
/* Set no-label (default) bottom border */
treechildren::-moz-tree-cell {
    border-bottom: 1px solid #FFFFFF !important;
}
</pre>
<p>I&#8217;ve also created a <a href="https://gist.github.com/757944" title="pretty thunderbird label gist">snippet for pretty labels</a> on GitHub. Enjoy!</p>
<p>You can add to these easily by using the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/1806">Thunderbird DOM Inspector</a>. I know my brilliant readers have some more of these up their sleeves so let&#8217;s see what tweaks you have for <a href="http://www.mozilla.com/en-US/thunderbird/">Thunderbird</a> in the comments!</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/thunderbird/jazz-up-thunderbird-tags/' rel='bookmark' title='Jazz up your new Thunderbird tags'>Jazz up your new Thunderbird tags</a></li>
<li><a href='http://eriwen.com/firefox/firefox-3-chrome-tweaks/' rel='bookmark' title='Early Adopters: Your Firefox 3 chrome tweaks are HERE'>Early Adopters: Your Firefox 3 chrome tweaks are HERE</a></li>
<li><a href='http://eriwen.com/firefox/howto-tweak-chrome-for-a-cleaner-firefox/' rel='bookmark' title='Tweak chrome for a cleaner Firefox'>Tweak chrome for a cleaner Firefox</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/tweaking-thunderbirds-chrome/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>CSS Adjacent Sibling Selectors</title>
		<link>http://eriwen.com/css/css-adjacent-sibling-selectors/</link>
		<comments>http://eriwen.com/css/css-adjacent-sibling-selectors/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 06:47:07 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://eriwen.com/css/css-adjacent-sibling-selectors/</guid>
		<description><![CDATA[Among the types of <acronym title="Cascading Style Sheets">CSS</acronym> selectors, one that is often overlooked is the <a href="http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors">CSS Adjacent Selector</a>.
<blockquote>Adjacent sibling selectors have the following syntax: E1 + E2, where E2 is the subject of the selector. The selector matches if E1 and E2 share the same parent in the document tree and E1 immediately precedes E2.</blockquote>
<h4>The CSS code</h4> <a href="http://eriwen.com/css/css-adjacent-sibling-selectors/">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://eriwen.com/css/css-indirect-adjacent-combinator/' rel='bookmark' title='About the indirect adjacent combinator (~) in CSS'>About the indirect adjacent combinator (~) in CSS</a></li>
<li><a href='http://eriwen.com/css/tweaking-thunderbirds-chrome/' rel='bookmark' title='Personalize your Thunderbird by changing it&#8217;s chrome'>Personalize your Thunderbird by changing it&#8217;s chrome</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Among the types of <acronym title="Cascading Style Sheets">CSS</acronym> selectors, one that is often overlooked is the <a href="http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors">CSS Adjacent Selector</a>.</p>
<blockquote><p>Adjacent sibling selectors have the following syntax: E1 + E2, where E2 is the subject of the selector. The selector matches if E1 and E2 share the same parent in the document tree and E1 immediately precedes E2.</p></blockquote>
<h2>The CSS code</h2>
<pre class="brush: css; title: ; notranslate">
h4 + p {
    font-weight: bold;
    color: #000;
}
</pre>
<p>The text below is a simple example of the above code:</p>
<style type="text/css"> h4.example + p { font-weight: bold; color: #000; }</style>
<h4 class="example">This is normal heading 4 text</h4>
<p>This is the &lt;p&gt; after the heading. It should be bold and black.</p>
<p>What&#8217;s even better is that this seems to work perfectly in IE 7 (UPDATE: it seems that this does not work in IE6, so it will be a bit before this is usable on any large scale. However, it is still good to understand these obscure CSS selectors because you may come across them as a professional, especially if IE8 successfully puts IE6 out of the top 5 browsers), <a href="http://getfirefox.com">Firefox</a>, <a href="http://opera.com">Opera</a>, and Safari. Now I know what you&#8217;re thinking. Where in the world am I going to use this?</p>
<p>Perhaps we could use something like this to do something to all rows in a table except the first row? What if we knew the next element after an &lt;img&gt; tag was going to be a custom caption that we wanted to place properly underneath our image? The only problem I see is that this couples the HTML and CSS more than we might like sometimes. However, there are many places that probably would benefit from something this simple.  <strong>Simplicity rules</strong>. Now that you know how to use it I have every confidence you can come up with a brilliant use for it.</p>
<p>What ideas do you have to use this <acronym title="Cascading Style Sheets">CSS</acronym> gem? What other selectors have you found useful but don&#8217;t often see?</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/css/css-indirect-adjacent-combinator/' rel='bookmark' title='About the indirect adjacent combinator (~) in CSS'>About the indirect adjacent combinator (~) in CSS</a></li>
<li><a href='http://eriwen.com/css/tweaking-thunderbirds-chrome/' rel='bookmark' title='Personalize your Thunderbird by changing it&#8217;s chrome'>Personalize your Thunderbird by changing it&#8217;s chrome</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/css-adjacent-sibling-selectors/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>

