<?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>athe.la blog &#187; css</title>
	<atom:link href="http://blog.athe.la/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.athe.la</link>
	<description>how to internets with style</description>
	<lastBuildDate>Mon, 30 Jan 2012 20:37:35 +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>Fixing the flyout delay in the Sharepoint dynamic navigation</title>
		<link>http://blog.athe.la/fixing-the-flyout-delay-in-the-sharepoint-dynamic-navigation/</link>
		<comments>http://blog.athe.la/fixing-the-flyout-delay-in-the-sharepoint-dynamic-navigation/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 15:37:34 +0000</pubDate>
		<dc:creator>Dan Cooper</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://blog.athe.la/?p=317</guid>
		<description><![CDATA[Sharepoint has a nasty habbit of keep navigation flyouts on the screen for a good second before they hide.  This is probably to aid accessibility where a user might not have precise mouse control.  However if you&#8217;re a good designer then you should have plenty of large clickable navigation menu items and plenty of white <a href='http://blog.athe.la/fixing-the-flyout-delay-in-the-sharepoint-dynamic-navigation/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Sharepoint has a nasty habbit of keep navigation flyouts on the screen for a good second before they hide.  This is probably to aid accessibility where a user might not have precise mouse control.  However if you&#8217;re a good designer then you should have plenty of large clickable navigation menu items and plenty of white space.</p>
<p>When rolling over a number of flyouts quickly, the user sees all the flyouts shown on the screen at once which looks rubbish.  To remove the delay altogether use this css in your page somewhere:</p>
<pre class="brush: css; title: ; notranslate">
li.hover-off&gt;ul
{
    display:none;
}
</pre>
<p>The way it works is when you hover over an item in the nav the built in sharepoint javascript adds a css class called &#8220;hover&#8221; and as soon as your mouse leaves the area it changes the class to &#8220;hover-off&#8221; for 1 second before removing it completely. This CSS will hide the unordered list directly below the list item that has the class &#8220;hover-off&#8221; thus hiding the flyout as soon as your mouse leaves the parent.</p>
<p>(P.s. this kind of flyout navigation can be set up by setting the &#8216;MaximumDynamicDisplayLevels&#8217; attribute of the SharePoint:AspMenu control)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.athe.la/fixing-the-flyout-delay-in-the-sharepoint-dynamic-navigation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Highlighting the Top n Rows of a Table</title>
		<link>http://blog.athe.la/highlighting-the-top-n-rows-of-a-table/</link>
		<comments>http://blog.athe.la/highlighting-the-top-n-rows-of-a-table/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 12:29:42 +0000</pubDate>
		<dc:creator>Dan Cooper</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://blog.athe.la/?p=233</guid>
		<description><![CDATA[I just read a great article on css-tricks about how the nth-child selector works.  What really shone out to me was the use of using a negative n value plus a number as in, &#8216;-n+5&#8242;.  What this would do is only select the top 5 rows!  This is very clever and I&#8217;m definitely going to <a href='http://blog.athe.la/highlighting-the-top-n-rows-of-a-table/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I just read a great <a href="http://css-tricks.com/how-nth-child-works/">article</a> on css-tricks about how the nth-child selector works.  What really shone out to me was the use of using a negative n value plus a number as in, &#8216;-n+5&#8242;.  What this would do is only select the top 5 rows!  This is very clever and I&#8217;m definitely going to be using this in the future.</p>
<p>A practical use of this technique is to imagine a high score table with lots of rows each detailing a person&#8217;s high score.  You want to highlight the top three to indicate that these people are the ones to be commended and enlarge the top scorer to emphasise their achievement.  You would use this css:</p>
<pre class="brush: css; title: ; notranslate">
table#highscores tr td {
    background-color: #666; /* default values */
    height: 20px;
}

table#highscores tr:first-child td {
    height: 40px; /* increase the row height of the top scorer */
}

table#highscores tr:nth-child(-n+3) td {
    background-color: #889; /* emphasise the top three */
}
</pre>
</pre>
<p>Unforunately and unsurprisingly, this doesn't work in the most popular<span style="color: #ff00ff;">*</span> browser in the world, Internet Explorer 8 and below.  For those, you'll have to use <a href="http://www.jquery.com">jQuery</a> and its implementation of nth-child.  Like what was mentioned in the article on css-tricks though, this technique shouldn't really be used for fundamental website design where the layout or usability would be effected by it not being implemented.  Allowing the website to degrade gracefully for browsers with no implementation is key.</p>
<p><span style="color: #ff00ff;">*</span> <em>By most popular, I really mean most widely-used.  I doubt that a large proportion of the internet population are using IE8 because they actually prefer IE8 to other browsers or they wouldn't switch if they had the opportunity, such as business users whose systems are locked down</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.athe.la/highlighting-the-top-n-rows-of-a-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Vertically Align Text Within an Element</title>
		<link>http://blog.athe.la/how-to-vertically-align-text-within-an-element/</link>
		<comments>http://blog.athe.la/how-to-vertically-align-text-within-an-element/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 12:33:14 +0000</pubDate>
		<dc:creator>Dan Cooper</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[quick tip]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://atheladev.wordpress.com/?p=154</guid>
		<description><![CDATA[Just thought I’d let you all know of a quick trick to get your text to vertically align within an element without using nasty padding or margin hacks. If you know that your element is going to be a certain height, then you can use the css attribute ‘line-height’ and give it the same value <a href='http://blog.athe.la/how-to-vertically-align-text-within-an-element/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Just thought I’d let you all know of a quick trick to get your text to vertically align within an element without using nasty padding or margin hacks. If you know that your element is going to be a certain height, then you can use the css attribute ‘line-height’ and give it the same value as the height of the object. Please note that this will only work where there is only a single line of text.</p>
<p><a rel="attachment wp-att-155" href="http://blog.athe.la/2010/01/how-to-vertically-align-text-within-an-element/7lb8k/"><img class="aligncenter size-full wp-image-155" title="My Buy Holiday button" src="http://blog.athe.la/wp-content/uploads/2010/01/7lb8k.png" alt="" width="128" height="48" /></a></p>
<p>The background colour I&#8217;m using is #EFF8F8</p>
<p>Here I have a pseudo-button and actually it&#8217;s just a text link within a &lt;p&gt;. Here’s the HTML and css:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;p class=&quot;actionbutton&quot;&gt;&lt;a href=&quot;/BuyingAndSelling/BuyHoliday&quot;&gt;Buy Holiday&lt;/a&gt;&lt;/p&gt;
</pre>
<pre class="brush: css; title: ; notranslate">

p.actionbutton
{
margin:0 auto 1em auto; /*center the button on the page*/
text-align:center;
width:124px;
height:44px;
}

p.actionbutton a
{
line-height:44px; /* same height as actionbutton element */
font-size:1.2em;
display:block; /* makes the whole area clickable rather than just the text */
text-decoration:none;
color:Black;
background-image: url('smartbutton.gif');
}

/*rollover*/
p.actionbutton a:hover
{
color:DarkOrange;
background-image: url('smartbutton-down.gif');
}
</pre>
<p>Here are the source images for you to play around with</p>
<div id="attachment_160" class="wp-caption alignleft" style="width: 134px"><a rel="attachment wp-att-160" href="http://blog.athe.la/2010/01/how-to-vertically-align-text-within-an-element/luoi1/"><img class="size-full wp-image-160 " title="normal button" src="http://blog.athe.la/wp-content/uploads/2010/01/luoi1.gif" alt="" width="124" height="44" /></a><p class="wp-caption-text">Normal button state</p></div>
<p><div id="attachment_161" class="wp-caption alignleft" style="width: 134px"><a rel="attachment wp-att-161" href="http://blog.athe.la/2010/01/how-to-vertically-align-text-within-an-element/s7cr5/"><img class="size-full wp-image-161 " title="rollover button" src="http://blog.athe.la/wp-content/uploads/2010/01/s7cr5.gif" alt="" width="124" height="44" /></a><p class="wp-caption-text">On mouse rollover</p></div><br />
<br style="clear:both"/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.athe.la/how-to-vertically-align-text-within-an-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic CSS Sprites</title>
		<link>http://blog.athe.la/dynamic-css-sprites/</link>
		<comments>http://blog.athe.la/dynamic-css-sprites/#comments</comments>
		<pubDate>Sat, 23 May 2009 23:04:30 +0000</pubDate>
		<dc:creator>Dan Cooper</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[background-position]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[pie chart]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://atheladev.wordpress.com/?p=99</guid>
		<description><![CDATA[Hi, ok if you don&#8217;t know what a sprite is then this post might get confusing quite quickly.  I&#8217;d suggest having a quick read up and find out what they are.  Simply put, the technique of using a CSS Sprite is so that you can reduce the number of HTTP requests browsers make to your <a href='http://blog.athe.la/dynamic-css-sprites/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Hi, ok if you don&#8217;t know what a sprite is then this post might get confusing quite quickly.  I&#8217;d suggest having a quick <a href="http://css-tricks.com/css-sprites/">read up</a> and find out what they are.  Simply put, the technique of using a CSS Sprite is so that you can reduce the number of HTTP requests browsers make to your server by only showing a <strong>portion</strong> of a larger image by changing the background-position (so that only the bit you want to see is showing through the object).  Another use for them (and this is the one we&#8217;ll be using here) is for convenience.</p>
<p>A <strong>pie chart </strong>of increasing values 0-100% could be stored as 20 separate independent images, named pie-[00-100].gif.  This however is inefficient for both the browser, the server, and the user.  The user will have to wait for the image to download if they haven&#8217;t already seen it (and hence cached it).  In my example I have 20 pie charts of increasing values in one image.  The background-position css property will dynamically change via server-side code to show only one of the 20 available pie charts.</p>
<p>Here&#8217;s the finished article:</p>
<p style="text-align: left;"><a href="http://blog.athe.la/wp-content/uploads/2009/05/pie-finalresult.gif"><img class="size-full wp-image-100 aligncenter" title="pie-finalresult" src="http://blog.athe.la/wp-content/uploads/2009/05/pie-finalresult.gif" alt="pie-finalresult" width="331" height="158" /></a>Here&#8217;s how it was done&#8230;</p>
<p><span id="more-99"></span></p>
<p style="text-align: left;">my models.py:</p>
<pre class="brush: python; title: ; notranslate">class Question(models.Model):
[........]
def offset(self, total, votes, full_length, slice_length):
    desired_length = (full_length - slice_length) * (votes/total)
    offset_pixels, remainder = divmod(desired_length,slice_length)
    offset_pixels *= slice_length
    if (remainder &gt; slice_length / 2.0):
        offset_pixels += slice_length
    return str(offset_pixels) + 'px'

def yes_pie_offset(self, full_length, slice_length):
    if self.num_votes &gt; 0:
        return self.offset(self.num_votes, self.num_yes, full_length, slice_length)
    else:
        return &quot;0px&quot;

def no_pie_offset(self, full_length, slice_length):
    if self.num_votes &gt; 0:
        return self.offset(self.num_votes, self.num_no, full_length, slice_length)
    else:
        return &quot;0px&quot;
</pre>
<p>my views.py</p>
<pre class="brush: python; title: ; notranslate">yes_pie = question.yes_pie_offset(630,30)
no_pie = question.no_pie_offset(630,30)</pre>
<p>template where it&#8217;s in use:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;pie greenpie&quot; style=&quot;background-position:-{{yes_pie}} 0&quot;&gt;&lt;/div&gt;
</pre>
<p>Basically, the view gives the model&#8217;s methods two arguments, the entire length of the sprite, and how long each image is.  The methods will use two of their own values to come up with how much to fill the pie chart.  It will return a positive integer that is a multiple of the individual image length.  Remember to use a negative sign before the template tag if your sprite goes from low to high (as my example below)</p>
<p style="text-align: center;"><a href="http://blog.athe.la/wp-content/uploads/2009/05/pie-green.gif"><img class="size-medium wp-image-107 aligncenter" title="pie-green" src="http://blog.athe.la/wp-content/uploads/2009/05/pie-green.gif?w=300" alt="pie-green" width="300" height="14" /></a></p>
<p style="text-align: left;">I got this image from <a href="http://petewilliamsagency.com/css/examples/pie/">here </a>but had to add my own 0% pie chart to the very left</p>
<p style="text-align: left;">(sorry if you didn&#8217;t understand this, I&#8217;m very tired now and can&#8217;t explain myself very well)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.athe.la/dynamic-css-sprites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

