<?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>Muffin Research Labs &#187; CSS</title>
	<atom:link href="http://muffinresearch.co.uk/archives/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://muffinresearch.co.uk</link>
	<description>the personal blog of Stuart Colville covering modern web development techniques and best practices</description>
	<lastBuildDate>Thu, 15 Mar 2012 10:10:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CSS2 text-decoration and child elements</title>
		<link>http://muffinresearch.co.uk/archives/2009/03/09/css2-text-decoration-and-child-elements/</link>
		<comments>http://muffinresearch.co.uk/archives/2009/03/09/css2-text-decoration-and-child-elements/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 00:40:00 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/?p=398</guid>
		<description><![CDATA[Take the following code; will the text in the span be underlined? &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD HTML 4.01//EN&#34; &#34;http://www.w3.org/TR/html4/strict.dtd&#34;&#62; &#60;html lang=&#34;en&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34;&#62; &#60;title&#62;Span Underline Test&#60;/title&#62; &#60;style type=&#34;text/css&#34; media=&#34;screen&#34;&#62; p{ text-decoration: underline; } p span { text-decoration: none; color: green; } &#60;/style&#62; &#60;/head&#62; &#60;body&#62; &#60;p class=&#34;test&#34;&#62;This is underlined.&#60;span&#62; Is this underlined?&#60;/span&#62;&#60;/p&#62; &#60;/body&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Take the following code; will the text in the span be underlined?</p>
<pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;
   &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;

&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
	&lt;title&gt;Span Underline Test&lt;/title&gt;
	&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
	   p{
	       text-decoration: underline;
	   }
	   p span {
	       text-decoration: none;
	       color: green;
	   }
	&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;p class=&quot;test&quot;&gt;This is underlined.&lt;span&gt; Is this underlined?&lt;/span&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>Chances are you&#8217;ll be thinking (like I did) that the text within the span won&#8217;t be underlined but you&#8217;d be wrong. Really &#8211; <a href="http://muffinresearch.co.uk/code/css/span_underlines/">try it for yourself</a>.</p>
<p>Finding the behaviour odd I dug up the <a href="http://www.w3.org/TR/CSS2/text.html#q3">specs for text-decoration</a>.</p>
<blockquote><p>This property describes decorations that are added to the text of an element. If the property is specified for a block-level element, it affects all inline-level descendants of the element. If it is specified for (or affects) an inline-level element, it affects all boxes generated by the element. If the element has no content or no text content (e.g., the IMG element in HTML), user agents must ignore this property. </p></blockquote>
<p>What it doesn&#8217;t say is whether inline elements can override the behaviour,  though as the spec states this isn&#8217;t an inheritable value and it would seem this is why the rule for the span has no effect.</p>
<p>Perhaps unsurprisingly <a href="http://muffinresearch.co.uk/i/span-underline-test-20090309-003330.png">Firebug also mis-interprets the value of the span</a> making the  assumption that text-decoration can be overriden. (Update 03/04/09:<a href="http://code.google.com/p/fbug/issues/detail?id=1629"> Bug raised</a>)</p>
<p>The good news is ie6/7, firefox, safari and opera are all consistent in their handling of this oddity.</p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2009/03/09/css2-text-decoration-and-child-elements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create your own Google Talk Theme using CSS</title>
		<link>http://muffinresearch.co.uk/archives/2006/04/17/create-your-own-google-talk-theme-using-css/</link>
		<comments>http://muffinresearch.co.uk/archives/2006/04/17/create-your-own-google-talk-theme-using-css/#comments</comments>
		<pubDate>Mon, 17 Apr 2006 19:17:14 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/04/17/create-your-own-google-talk-theme-using-css/</guid>
		<description><![CDATA[Not so long ago Google Talk received an update which included theme support, now I don&#8217;t know about you, but in my humble opinion the default themes weren&#8217;t all that great. The good new is that the themes are created with CSS so this means that you can copy an existing theme and modify it [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/i/chatscrsht.png"  class="floated" alt="Muffin Research Google Talk Theme Screenshot" /></p>
<p>Not so long ago Google Talk received an update which included theme support, now I don&#8217;t know about you, but in my humble opinion the default themes weren&#8217;t all that great. The good new is that the themes are created with CSS so this means that you can copy an existing theme and modify it to get something that is more to your taste.</p>
<p>To get started you need to copy an existing theme, so choose one as a starting point. Before you can do that you will need to create a directory called &#8220;chat&#8221; in the following location (Where [PROFILE NAME] is your changed to the name of your user profile, this is the same as the user your login to windows as):</p>
<pre><code>C:\Documents and Settings\[PROFILE NAME]\Local Settings\Application Data\Google\Google Talk\themes\user\</code></pre>
<p>Next copy the theme you wish to base yours on to here:</p>
<pre><code>C:\Documents and Settings\[PROFILE NAME]\Local Settings\Application Data\Google\Google Talk\themes\user\chat\</code></pre>
<p>Rename the chat theme folder you have just copied across to the name of your choice. This name will show up in the themes menu. Edit the themes CSS file ([ThemeName]\Contents\Resources\main.css) and then test your theme. </p>
<p>To get you started <a href="/downloads/MuffinResearch.zip">here&#8217;s a theme I made earlier called MuffinResearch</a>. To use it just uppack the theme to this directory:</p>
<pre><code>C:\Documents and Settings\[PROFILE NAME]\Local Settings\Application Data\Google\Google Talk\themes\user\chat\</code></pre>
<p>As you are editing the themes all you have to do is re-select your theme in the drop-down to check the styles you have modified.</p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2006/04/17/create-your-own-google-talk-theme-using-css/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>CSS Drop Column Layout</title>
		<link>http://muffinresearch.co.uk/archives/2006/02/07/css-drop-column-layout/</link>
		<comments>http://muffinresearch.co.uk/archives/2006/02/07/css-drop-column-layout/#comments</comments>
		<pubDate>Tue, 07 Feb 2006 00:05:00 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://dev.muffinresearch.co.uk/archives/2006/02/07/css-drop-column-layout/</guid>
		<description><![CDATA[Simon Collison posted an article about his new fixed width 3-column layout which is made possible with a dash of javascript to alter the layout based on the resolution of the client&#8217;s window. For more on Simon&#8217;s layout see this post. Tim referred to my site in the comments on Collylogic saying that my site [...]]]></description>
			<content:encoded><![CDATA[<p>Simon Collison posted an article about his new fixed width 3-column layout which is made possible with a dash of javascript to alter the layout based on the resolution of the client&#8217;s window. <a href="http://www.collylogic.com/?/comments/redesign-notes-1-width-based-layout/">For more on Simon&#8217;s layout see this post</a>. <a href='http://www.nefariousdesigns.co.uk'>Tim</a> referred to my site in the comments on Collylogic saying that my site covered the same functionality without requiring javascript. So this post is a more detailed explanation on how my layout works.</p>
<p>When I created this site I wanted to have 4 columns which are all fixed width. The idea was that if you resized the window then the columns would drop down when there wasn&#8217;t enough room. To explain in greater detail here is a visual:</p>
<p><img src='/i/columns.gif' alt='Diagram of resizing browser window causing 4th column to drop' /></p>
<p>To achieve the desired effect I am using floats. A natural property of a floated element is to drop down when there isn&#8217;t enough room until there is enough space. This means that the column on the furthest right will drop when the window is re-sized. One of the issues with this would be if the primary content column was not high enough the displaced column would wrap underneath it. To combat this undesired effect I have used a wrapper with a left margin to &#8216;hold&#8217; the 3 smaller columns to the right of the primary content.</p>
<h2>Limitations</h2>
<p>There are a couple of limitations with this technique. The 4th (quaternary) column will drop underneath the 2nd (secondary) column if the 2nd (secondary) column is the same height or less tall than the 3rd (Tertiary) column.</p>
<p>A min-width was set on the body so that a horizontal scroll-bar will appear if the window is resized below 770px. This doesn&#8217;t work in IE and neither does the proprietary expression.</p>
<h2>The demos</h2>
<p>The following demos are grossly over simplified but give you an idea of how this layout works.</p>
<ul class="intr">
<li><a href="http://muffinresearch.co.uk/code/xhtmlandcss/dropcolumn/1/">Drop Column Demo</a></li>
<li><a href="http://muffinresearch.co.uk/code/xhtmlandcss/dropcolumn/2/">Incorrect demo without wrapper</a></li>
</ul>
<p>Update: Richard Rutter has written up a <a href="http://clagnut.com/blog/1663/">concise round up of related layouts</a> in response to <a href="http://www.collylogic.com/?/comments/redesign-notes-1-width-based-layout/">Colly&#8217;s original post</a>.</p>
<p>A <a href="http://www.fatcow.com/edu/css-drop-column-layout-be/">Belorussian translation of this post</a> has been kindly provided by Amanda Lynn</p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2006/02/07/css-drop-column-layout/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Partial Image Replacement</title>
		<link>http://muffinresearch.co.uk/archives/2006/01/29/partial-image-replacement/</link>
		<comments>http://muffinresearch.co.uk/archives/2006/01/29/partial-image-replacement/#comments</comments>
		<pubDate>Sun, 29 Jan 2006 01:41:11 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://dev.muffinresearch.co.uk/archives/2006/01/29/partial-image-replacement-2/</guid>
		<description><![CDATA[Recently Tim was looking for opinions on the most semantic way to mark up the title and strapline of an author&#8217;s website that he is working on. The text looked something like this; Stuart Colville, Author of &#34;I&#8217;m a big fat monkey&#34; (Note: this is a fictitious title). Now the question was, how should the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently <a href='http://www.nefariousdesigns.co.uk'>Tim</a> was looking for opinions on the most semantic way to mark up the title and strapline of an author&#8217;s website that he is working on. The text looked something like this; Stuart Colville, Author of &quot;I&#8217;m a big fat monkey&quot; (Note: this is a fictitious title).</p>
<p>Now the question was, how should the strapline (Author of &#8220;I&#8217;m a big fat monkey&#8221;) be marked up in a meaningful way? After a while of talking it through I suggested that the best way would be to including the strapline in with the heading as they have a relationship to one another. To move the strapline out of the h element would destroy the relationship. So the mark-up ended up looking like this:</p>
<pre>
<code>&lt;h1&gt;Stuart Colville, &lt;span&gt;Author of &quot;I'm a big fat monkey&quot;&lt;/span&gt;&lt;/h1&gt;</code>
</pre>
<h2>The Experiment</h2>
<p>Now I was then interested to know if you could use image replacement to replace the h1 whilst leaving the span on screen as text. I tried a little experiment and came up with the following CSS:</p>
<pre>
<code>
  #content h1
  {
    text-indent: -3000px;
    overflow: hidden;
    background: url(scolville.gif) no-repeat;
    height: 100px;
    position: relative; /* optional: remove this if you need to position the span relative to the page rather than relative to the h1 */
  }

  #content h1 span
  {
    text-indent: 0;
    position: absolute;
    top: 75px;
    left: 50px;
    font-style: italic;
    font-size: 80%;
  }
</code>
</pre>
<p>Using the original <a href='http://phark.typepad.com/phark/2003/08/accessible_imag.html'>Phark method</a> I replaced the text within the h1 with a &#8216;tasty&#8217; logo and then to counter the text-indent I used absolute positioning on the span thus moving back into view. Now this looked to be the answer first of all but this didn&#8217;t work at all in IE. After a little futher experimentation I ended up zeroing the text-indent first and used absolute positioning to move the span into position.</p>
<h2>Example</h2>
<p>The results can be viewed here in this <a href="/code/xhtmlandcss/PIR/">example</a> and works in IE6, Opera, Firefox and Safari.</p>
<p class="update">Update: Tim made a useful suggestion to add &quot;position:relative&quot; to the h1 so that the span is relative to that rather than to the page. I have updated the code to reflect this change.</p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2006/01/29/partial-image-replacement/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Table showcase site</title>
		<link>http://muffinresearch.co.uk/archives/2005/09/01/table-showcase-site/</link>
		<comments>http://muffinresearch.co.uk/archives/2005/09/01/table-showcase-site/#comments</comments>
		<pubDate>Thu, 01 Sep 2005 21:11:55 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://dev.muffinresearch.co.uk/archives/2005/09/01/table-showcase-site/</guid>
		<description><![CDATA[Chris Heilmann has come up with the great idea of a CSS table showcase to show off different table designs. Being the enthusiastic chap I am, I&#8217;ve contributed my own table design entitled &#8216;Grey suits you sir!&#8217; I&#8217;m pretty sure this site will be a useful resource as it grows into the future.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wait-till-i.com">Chris Heilmann</a> has come up with the great idea of a <a href="http://icant.co.uk/csstablegallery/">CSS table showcase</a> to show off different table designs.</p>
<p>Being the enthusiastic chap I am, I&#8217;ve contributed my own table design entitled <a href="http://icant.co.uk/csstablegallery/index.php?css=6">&#8216;Grey suits you sir!&#8217;</a> I&#8217;m pretty sure this site will be a useful resource as it grows into the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2005/09/01/table-showcase-site/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Classes on the body tag</title>
		<link>http://muffinresearch.co.uk/archives/2005/06/16/classes-on-the-body-tag/</link>
		<comments>http://muffinresearch.co.uk/archives/2005/06/16/classes-on-the-body-tag/#comments</comments>
		<pubDate>Thu, 16 Jun 2005 00:26:41 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://dev.muffinresearch.co.uk/archives/2005/06/16/classes-on-the-body-tag/</guid>
		<description><![CDATA[In Doug Bowman&#8217;s second @media presentation he mentioned utilising classes on the body element to be able to affect the layout of the entire page. This simple technique uses descendant selectors in such a way that an entire page layout can be altered by adding or changing a class applied to the body tag. For [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.stopdesign.com">Doug Bowman&#8217;s</a> second @media presentation he mentioned utilising classes on the body element to be able to affect the layout of the entire page. This simple technique uses descendant selectors in such a way that an entire page layout can be altered by adding or changing a class applied to the body tag.</p>
<p>For example visualise the following (simplified) stylesheet</p>
<pre><code>
  #maincontent {
    float : left
  }

  #secondarycontent  {
    float  : right
  }

  .home #maincontent {
    float  : right
  }

  .home #secondarycontent  {
    float  : left
  }</code></pre>
<p>Assuming maincontent and secondarycontent are two divs, by adding the class &#8216;home&#8217; to the body tag (&lt;body class=&#8221;home&#8221;&gt;), the two columns could be reversed. When you think about it, this method can be used to radically change the entire site layout with only one change to the markup and without requiring extra stylesheets. It&#8217;s this exact method used to alter the look of each of the sections on Doug&#8217;s site <a href="http://www.stopdesign.com">http://www.stopdesign.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2005/06/16/classes-on-the-body-tag/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A beginner&#8217;s guide to CSS hack avoidance</title>
		<link>http://muffinresearch.co.uk/archives/2005/05/10/a-beginners-guide-to-css-hack-avoidance/</link>
		<comments>http://muffinresearch.co.uk/archives/2005/05/10/a-beginners-guide-to-css-hack-avoidance/#comments</comments>
		<pubDate>Tue, 10 May 2005 19:04:39 +0000</pubDate>
		<dc:creator>Stuart Colville</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://dev.muffinresearch.co.uk/archives/2005/05/10/a-beginners-guide-to-css-hack-avoidance/</guid>
		<description><![CDATA[Whilst working on some CSS designs recently I realised that by zeroing the padding and margin of various elements in I was avoiding my pages having major differences when viewed in different browsers. Often these differences in rendering are caused by the default styles applied to pages by the browser. It&#8217;s these styles that come [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst working on some CSS designs recently I realised that by zeroing the padding and margin of various elements in I was avoiding my pages having major differences when viewed in different browsers. Often these differences in rendering are caused by the default styles applied to pages by the browser. It&#8217;s these styles that come into play whenever you view a page without a stylesheet.</p>
<p>Once you learn how to use <a href="http://www.dithered.com/css_filters/" title="http://www.dithered.com/css_filters/">CSS hacks</a> if you are at all inclined to be lazy you might find yourself utilising CSS hacks even when there&#8217;s no real need. So before you use that hack you must ask yourself the question is there an easier way? </p>
<p>To illustrate the point I knocked up a <a href="/lab/defcss.html" title="view the test page">quick page</a> to test out the theory that all browsers are different before you even start to apply CSS rules. In addition here is an <a href="/lab/defcss.gif" title="View differences between browsers">screenshot</a> to show the difference side-by-side for IE 6.0, Firefox, and Opera 8.0.</p>
<p>As you can clearly see there&#8217;s a need to reset the styles so that when you apply your stylesheet all browsers are starting from the same place. One way to do this would be to use global rules on all of the tags that you are going to use. Like so:</p>
<pre><code>
  p, h1, h2, h3, h4, h5, h6, ul, ol, fieldset, form {
      margin  : 0;
      padding : 0;
  }</code></pre>
<p>In doing this you will have to then specify the paddings and margins on each element that you are styling manually. Which is no big deal, however, you could specify a global rule including your own defaults and work forward from that:</p>
<pre><code>
  p, h1, h2, h3, h4, h5, h6, ul, ol, fieldset, form {
      margin  : 1em 0 0 0;
      padding : 0;
  }</code></pre>
<p>Alternatively for browsers that understand it you could create a global rule for all elements like so:</p>
<pre><code>
*  {
      margin  : 0;
      padding : 0;
  }</code></pre>
<p>Thus saving you from having to add each element separately. See the links below for more on this method.</p>
<p>Now before anyone comments that I haven&#8217;t followed this advice completely myself, well that&#8217;s true but I&#8217;ve only implemented this where I thought it most important, how far <em>you</em> go with this is entirely up to you!</p>
<p>Now before I posted this article I did a quick google to see if anyone&#8217;s been here before I have, and there are a couple of articles that touch on the same area, so kudos goes to them for their endeavours.</p>
<ul class="ext">
<li><a href="http://www.clagnut.com/blog/1287/">Richard Rutter (Clagnut) &#8211; Resetting default padding and margin</a></li>
<li><a href="http://www.meyerweb.com/eric/thoughts/2004/09/15/emreallyem-undoing-htmlcss/">Eric Meyer &#8211; Really Undoing html.css</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://muffinresearch.co.uk/archives/2005/05/10/a-beginners-guide-to-css-hack-avoidance/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

