<?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>Candy by James &#187; CSS</title>
	<atom:link href="http://james.gameover.com/index.php/category/code/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.gameover.com</link>
	<description>A journal by a James</description>
	<lastBuildDate>Fri, 23 Jul 2010 17:08:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=449</generator>
		<item>
		<title>CSS3 @font-face browser support table</title>
		<link>http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/</link>
		<comments>http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 15:27:41 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=5328</guid>
		<description><![CDATA[It’s time for a CSS3 @font-face browser support table. One that documents specifically how browsers act when either the whole font family is specified (regular, italic, bold, bold-italic &#38; small-caps) or only the regular version of the font is specified. The test-case that this based on uses the ideal, easiest (laziest) implementation and can be [...]]]></description>
			<content:encoded><![CDATA[<p>It’s time for a CSS3 @font-face browser support table. One that documents specifically <em>how</em> browsers act when either the whole font family is specified (regular, <em>italic</em>, <strong>bold</strong>, <em><strong>bold-italic</strong></em> &amp; <span style="font-variant: small-caps;">small-caps</span>) or only the regular version of the font is specified. The <a href="http://james.gameover.com/zen/examples/font-face/index.html">test-case</a> that this based on uses <a href="http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/">the ideal, easiest (laziest) implementation</a> and can be found on <a href="http://james.gameover.com/zen/examples/font-face/index.html">its own page here</a>.</p>
<p>Here’s the results of how <em>current</em> browsers render the <a href="http://james.gameover.com/zen/examples/font-face/index.html">test case</a>, compared to the reference rendering.</p>
<h2>Can the browser pick up the style natively?</h2>
<table>
<tbody>
<tr>
<th></th>
<th>Firefox 3.6</th>
<th>Safari 4</th>
<th>Chrome 5</th>
<th>Opera 10.5a</th>
</tr>
<tr>
<td>Regular (Normal)</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Italic</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Bold</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Bold-Italic</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Small-Caps</td>
<td class="ok">Emulates</td>
<td class="ouch">Fallback system-font</td>
<td class="ouch">Fallback system-font</td>
<td class="ok">Emulates</td>
</tr>
<tr>
<td>Extras?</td>
<td>Ligatures!</td>
<td>-</td>
<td>-</td>
<td>Ligatures!</td>
</tr>
</tbody>
</table>
<h2>Can the browser emulate from the regular version?</h2>
<table>
<tbody>
<tr>
<th></th>
<th>Firefox 3.6</th>
<th>Safari 4</th>
<th>Chrome 5</th>
<th>Opera 10.5a</th>
</tr>
<tr>
<td>Regular (Normal)</td>
<td>(implied)</td>
<td>(implied)</td>
<td>(implied)</td>
<td>(implied)</td>
</tr>
<tr>
<td>Italic</td>
<td class="good">Yes</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
</tr>
<tr>
<td>Bold</td>
<td class="good">Yes</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
</tr>
<tr>
<td>Bold-Italic</td>
<td class="good">Yes</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
</tr>
<tr>
<td>Small-Caps</td>
<td class="good">Yes</td>
<td class="ouch">Fallback system-font</td>
<td class="ouch">Fallback system-font</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Extras?</td>
<td>Ligatures!</td>
<td>-</td>
<td>-</td>
<td>Ligatures!</td>
</tr>
</tbody>
</table>
<p>The most<a href="http://james.gameover.com/zen/examples/font-face/index.html#results"> up to date support table</a>, with pretty colours, can always be found <a href="http://james.gameover.com/zen/examples/font-face/index.html#results">on its own page alongside the test case</a>. It also has more notes on ligature and small-caps support.</p>
<h2>Why is falling back to regular style so bad?</h2>
<p>It makes sentences <em><strong>full</strong> of expression</em> look like sentences full of expression. Thus removing part of the typographical elements of a text, whereas @font-face is meant to embellish it typographically.</p>
<h2>So what does this mean we should do?</h2>
<h3>Browser developers:</h3>
<ul>
<li>Please work on emulating <strong>bold</strong>, <em>italic</em>, <strong><em>bold-italic</em></strong>, etc. when they’re not present. Browsers do this already when it comes to system-fonts, which means web developers expect this to work. Falling back to the regular style (font-style:normal) is horrible as you lose all styling in a text.</li>
<li>Also give some thought to picking up “<span style="font-variant: small-caps;">font-variant:small-caps;</span>” in your @font-face code. It’s the only way to ensure proper fall-back. Emulating, like Firefox &amp; Opera do, is a step forward, but it’d be a pity to stop there.</li>
<li>If HTML 5 has taught us anything, it’s that <em>browsers</em> should be more bulletproof, not web designer’s code. Also: asking web developers to <a href="http://diveintohtml5.org/semantics.html#the-doctype">specify as little as possible</a> is a better.</li>
</ul>
<h3>Web designers:</h3>
<ul>
<li>Using @font-face when you only have the regular version of a font at your disposal is not a good idea. Especially for body text.</li>
<li>If you use small-caps text, chances are visitors will see the fallback system-font. So make sure you specify a system-font that matches your @font-face font nicely when rendered as small-caps. (The test-case uses an especially jarring one on purpose.)</li>
<li>Using a (less lazy, less practical) <a href="http://paulirish.com/2009/bulletproof-font-face-Implementation-syntax/">more bulletproof way of specifying your @font-face fonts is recommended (alas)</a> for now.</li>
</ul>
<p><a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/" rel="bookmark">CSS3 @font-face browser support table</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 20 February 2010.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Vertically centring in css (without hacks and multi-line enabled)</title>
		<link>http://james.gameover.com/index.php/2009/vertically-centring-in-css-without-hacks-and-multi-line-enabled/</link>
		<comments>http://james.gameover.com/index.php/2009/vertically-centring-in-css-without-hacks-and-multi-line-enabled/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 16:09:28 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=397</guid>
		<description><![CDATA[Chris Coyier over at css-tricks.com had a great example of a css conundrum: how to centre, both vertically and horizontally, multiple lines of text. He some good code (using table-cell) but his code for IE relied on some (script)expressions which can have the unfortunate habbit of slowing down a page. [update: to get a bit [...]]]></description>
			<content:encoded><![CDATA[<p>Chris Coyier over at css-tricks.com had a <a href="http://css-tricks.com/vertically-center-multi-lined-text/">great example of a css conundrum</a>: how to centre, both vertically and horizontally, multiple lines of text. He some good code (using table-cell) but his code for IE relied on some (script)expressions which can have the unfortunate habbit of slowing down a page.</p>
<p>[<strong>update</strong>: to get a bit more background on absolute &amp; relative positioning, and how to center horizontally, read:  <a href="/index.php/2005/on-horisontal-css-centering-using-absolute-positioning/">On Horizontal CSS Centering using Absolute Positioning or how Relative Positioning can rock your css</a>.]</p>
<p>The regular way of <a rel="nofollow" href="http://www.jakpsatweb.cz/css/css-vertical-center-solution.html">vertically centring in css</a> has been documented by Dušan Janovský back in 2004. It needs an extra div for its IE solution, but it doesn’t require any expressions, only regular (fast!) css. Because a div-tag is semantically empty (like the span-tag), it doesn’t add any wrong semantic meaning (like a table-tag would).</p>
<p>The <code>.area</code> div isn’t stricly necessary, but it was in the original problem posed in the css-tricks.com article. I have however edited out the superfluous background declaration, as it doesn’t have anything to do with positioning.</p>
<blockquote><p>I’ve updated the example to use <a href="http://www.simonclayson.co.uk/reportage/comments/ie_6_text_only/">conditional comments</a> instead of hacks. The html (in your page) becomes:</p>
<p><code>&lt;div class="area" id="two"&gt;<br />
&lt;div class="bubble"&gt;<br />
&lt;div&gt;<br />
&lt;p&gt;Doing this may not be as easy or obvious as we would hope.&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
</code></p>
<p>The css (in your stylesheet) becomes:</p>
<p><code>.area {width:300px; height:300px; position:relative; float:left; }<br />
.bubble {position:absolute; left:93px; top:21px; width:135px; height:84px; display:table; }<br />
.bubble div {display:table-cell; vertical-align:middle; text-align:center;}<br />
</code></p>
<p>The IE specific css (in your html-page) becomes:</p>
<p><code>&lt;!--[if lt IE 8]&gt;<br />
&lt;style&gt;<br />
.bubble div {position:absolute; top:50%;}<br />
.bubble div p {position:relative; top:-50%}<br />
&lt;/style&gt;<br />
&lt;![endif]–&gt;</code></p></blockquote>
<p>Have a <a href="http://css-tricks.com/examples/VerticallyCenteredText/">look at the demo</a> to see what you should end up with. Questions welcome!</p>
<p><a href="http://james.gameover.com/index.php/2009/vertically-centring-in-css-without-hacks-and-multi-line-enabled/" rel="bookmark">Vertically centring in css (without hacks and multi-line enabled)</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 14 July 2009.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS3 Fonts: The ideal implementation</title>
		<link>http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/</link>
		<comments>http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 15:00:15 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=408</guid>
		<description><![CDATA[This series of articles is about the challenges that arise when using @font-face. Font licensing is one (that many others have written about) and the file-size of included font-files is another, but this article is about browser implementation eccentricities. I’ll start off by showing the ideal @font-face implementation in this article, before moving on to [...]]]></description>
			<content:encoded><![CDATA[<p>This series of articles is about the challenges that arise when using @font-face. Font licensing is one (that <a href="http://dbaron.org/log/20090317-fonts">many</a> <a href="http://blogs.msdn.com/b/ie/archive/2008/07/21/font-embedding-on-the-web.aspx">others</a> <a href="http://blog.typekit.com/2009/06/11/when-free-fonts-arent-free/">have</a><a href="http://www.webdirections.org/blog/the-return-of-font-embedding-to-the-web/"> written</a> about) and the file-size of included font-files is another, but this article is about browser implementation eccentricities. I’ll start off by showing the ideal @font-face implementation in this article, before moving on to showing current browser deficiencies and the implementation I settled on for including a full font-family which works in the here and now.</p>
<p><strong>update</strong>: For an <a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/">overview of current browser support</a> for CSS3’s @font-face see the <a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/">browser support tables</a>.</p>
<p>Ideally, designers would specify the font-file they wanted to use for regular text, and then one for each variation they had at their disposal (so, one for Bold, Italic, Bold Italic, Small Caps, Light, Ultra Condensed, etc.) – all using the same font-family name, so that all variations would be picked up automatically for body text, and, if @font-face isn’t supported by the browser,  all text will still display in the proper font-variant.</p>
<blockquote><p>To do that, your css would look something like this:</p>
<p><code>/* A font by Jos Buivenga (exljbris) -&gt; www.exljbris.nl */<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_R_45b.otf) format("opentype");<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_B_45b.otf) format("opentype");<br />
font-weight: bold;<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_I_45b.otf) format("opentype");<br />
font-style: italic;<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_BI_45b.otf) format("opentype");<br />
font-style: italic;<br />
font-weight: bold;<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_SC_45b.otf) format("opentype");<br />
font-variant: small-caps;<br />
}</code></p></blockquote>
<p>This would ensure proper fall-back in browsers that don’t support @font-face (or only part of it) and compatibility with current stylesheets, making @font-face implementation for designers plug-&amp;-play.</p>
<p>The <em>ideal</em> @font-face rendering (on the left) and fall-back rendering (on the right) would look a little like this (notice the fi-ligature!):</p>
<div class="insertimg"><a title="ideal-fallback by James John Malcolm, on Flickr" href="http://james.gameover.com/zen/examples/font-face/index.html#results"><img src="http://farm3.static.flickr.com/2620/3713309878_a9fb7bd82e.jpg" alt="ideal-fallback" width="500" height="209" /></a></div>
<p>You’ll have guessed by now that browsers haven’t reached this ideal implementation yet. You can find <a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/">the test-case and CSS3 @font-face browser support tables here</a>.</p>
<p><em>Information in this series was acquired while <a href="http://james.gameover.com/index.php/portfolio/#s-next">working on the design and css</a> for the site of Standards.next and subsequent tests afterwards. The Fontface used in this example is <a href="http://www.josbuivenga.demon.nl/fontinsans.html">Fontin Sans by Exljbris (Jos Buivenga)</a></em><em>.</em></p>
<p><a href="http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/" rel="bookmark">CSS3 Fonts: The ideal implementation</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 12 July 2009.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bye bye liquid layouts!</title>
		<link>http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/</link>
		<comments>http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 16:59:45 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/</guid>
		<description><![CDATA[Yes, I am predicting the death of liquid layout of web pages. Not all mind you, some web apps will still be liquid, but for the rest of the web: liquid is dead. This is a natural next step after declaring elastic layouts dead, so no surprises here. There are three main ways to define your [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, I am predicting the death of liquid layout of web pages. Not all mind you, some web apps will still be liquid, but for the rest of the web: liquid is dead. This is a natural next step after <a href="http://james.gameover.com/index.php/2008/px-vs-em-is-it-still-relevant/">declaring elastic layouts dead</a>, so no surprises here.</p>
<p>There are three main ways to define your layout in web design: fixed, elastic &amp; liquid. Having <a href="http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/">written about the differences between them</a> before, I’ll suffice with stating that fixed layouts are defined in “px” (pixels) and liquid ones in “%” (percentages).</p>
<p>Using a fixed layout means your web page is the same width irrespective of the viewers’ screen width, like so:</p>
<div class="insertimg"><img src="/zen/jjm-fixed-width-design.jpg" alt="Fixed layout." /></div>
<p>Using a liquid layout however, means your web page scales along with the viewers’ screen width, like so:</p>
<div class="insertimg"><img src="/zen/jjm-flexible-width-design.jpg" alt="Liquid layout." /></div>
<p>Liquid layouts used to have an edge over pixel layouts in the sense that they increased use of the screen real estate, thus providing more room if the viewer increased their text-size. <strong>Line-lengths are hard to control with liquid layouts</strong>, because of varying screen-sizes obviously, but also when the viewer increases (just) the text-size. Jason Kottke posted a <a href="http://www.kottke.org/01/05/attention-liquid-designers-take-a">good warning about line-lengths in liquid layouts</a> a while back:</p>
<blockquote><p>Attention liquid designers: take a gander at <a href="/zen/papyrus.jpg">this portion of an ancient Egyptian parchment</a> on papyrus from the Louvre. Even the ancient Egyptians knew not to make columns of text too wide.</p></blockquote>
<p>Now, however, most browsers have adopted full-page zooming over text-size zooming. Most provide both, but full-page zooming is the new default. Full-page zooming gives users with a wider screen (for example) the chance to increase the size of text and images, while still preserving the ratios of fixed layout pages, like so:</p>
<div class="insertimg"><img src="/zen/jjm-fixed-width-design-full-zoom.jpg" alt="Fixed design with full zoom." /></div>
<p>As you can see, full-page zooming means fixed layouts also provide increased use of screen real estate, but only <em>when needed</em>. In addition fixed layouts keep line-lengths relatively stable, and are easy to work with as they are based on pixels, just like images, videos and other objects you may have on your web page.</p>
<p><a href="http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/" rel="bookmark">Bye bye liquid layouts!</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 8 June 2008.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Elastic, Liquid, Pixel: Explained.</title>
		<link>http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/</link>
		<comments>http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/#comments</comments>
		<pubDate>Sun, 05 Mar 2006 22:18:25 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/index.php/2006/elastic-liquid-pixel-explained/</guid>
		<description><![CDATA[In ‘modern’ web design (as in, the last five years versus the five years before) there are three main ways to define your design. Also called ‘fixed’, the first and most used method uses pixel measurements to define the width (&#38; height) of elements on a page. The most obvious advantage to this method — [...]]]></description>
			<content:encoded><![CDATA[<p>In ‘modern’ web design (as in, the last five years versus the five years before) there are three main ways to define your design.</p>
<p>Also called ‘fixed’, the first and most used method uses pixel measurements to define the width (&amp; height) of elements on a page. The most obvious advantage to this method — and the reason it’s the easiest to get your head around — is that you get pixel perfect results with it. Photos and other fixed elements on your page will always fit, another huge advantage. That’s also its downfall however, as it doesn’t increase in size as text scales, making the defining of a good line-length quite difficult.</p>
<p>Which brings us to the next, most recent, method dubbed ‘elastic’. The crux of this method revolves around using ‘em’ to define (mainly) widths instead of ‘px’. You’ve already guessed of course that ‘px’ stands of pixel — but how is ‘em’ exactly defined? Well, an ‘em’ is the width a normal ‘m’ takes up on the screen. This method has the advantage of scaling along with the text. That means your line-length will always be exactly as you defined it, but, if an included picture were to take up more width than the current line-length, it’d stick out.</p>
<p>Liquid has been going in and out of fashion for a couple of years now. It uses percentages (defined with ‘%’ in one’s code of course) to define the width of elements. I think it was created with the intention of not squandering precious screen real estate, and while it does maximise the use of the screen, it has several flaws. Given that screen sizes can vary a great deal, a designer can never be certain the line-length is anywhere near correct and whether or not photos actually fit (pushing themselves off the screen, or worse, pushing the design off the screen!).</p>
<p>In my next article (not necessarily the next post!) I’ll talk more about handling the downsides of the methods and how a mix of them is often the most effective (and laden with browser flow errors — yikes!).</p>
<p><a href="http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/" rel="bookmark">Elastic, Liquid, Pixel: Explained.</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 5 March 2006.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS selectors explained properly</title>
		<link>http://james.gameover.com/index.php/2005/css-selectors-explained-properly/</link>
		<comments>http://james.gameover.com/index.php/2005/css-selectors-explained-properly/#comments</comments>
		<pubDate>Thu, 29 Dec 2005 21:43:28 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/?p=32</guid>
		<description><![CDATA[Looking for a good and simple explanation of the currently usable (and a few more) CSS selectors? Roger Johansson has taken the time to compile them all into a 3 part article. I can thoroughly recommend it to people wanting a nice overview of what tools are available to them in Cascading Style Sheets or [...]]]></description>
			<content:encoded><![CDATA[<p>Looking for a good and simple explanation of the currently usable (and a few more) CSS selectors? Roger Johansson has taken the time to compile them all into a 3 part article. I can thoroughly recommend it to people wanting a nice overview of what tools are available to them in Cascading Style Sheets or just want to know what the heck “.new + #important &gt; a:focus:first-letter” means. An oldie but a goody.</p>
<p><a href="http://www.456bereastreet.com/archive/200509/css_21_selectors_part_1/">Roger Johansson’s article over at 456 Bereastreet on CSS 2.1 Selectors (part 1)</a></p>
<p><a href="http://james.gameover.com/index.php/2005/css-selectors-explained-properly/" rel="bookmark">CSS selectors explained properly</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 29 December 2005.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>On Horizontal CSS Centering using Absolute Positioning or how Relative Positioning can rock your css.</title>
		<link>http://james.gameover.com/index.php/2005/on-horisontal-css-centering-using-absolute-positioning/</link>
		<comments>http://james.gameover.com/index.php/2005/on-horisontal-css-centering-using-absolute-positioning/#comments</comments>
		<pubDate>Sun, 02 Oct 2005 16:48:52 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Worthy]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/journal/index.php/2005/on-horisontal-css-centering-using-absolute-positioning-2/</guid>
		<description><![CDATA[In Joen’s daily work, he needs to centre a div horizontally. Usually this is easy. It gets a little trickier when using absolute positioned elements. [update: read how to do it vertically in: vertically centring in css (without hacks and multi-line enabled).] The method I use is to have a wrapper div with the following [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://noscope.com">Joen’s</a> daily work, he needs to centre a div horizontally. Usually this is easy. It gets a little trickier when using absolute positioned elements.</p>
<p>[update: read how to do it vertically in: <a href="/index.php/2009/vertically-centring-in-css-without-hacks-and-multi-line-enabled/">vertically centring in css (without hacks and multi-line enabled)</a>.]</p>
<p>The method I use is to have a wrapper div with the following css:<br />
<code><br />
.wrapper {<br />
position:relative;<br />
margin:0 auto;<br />
text-align:left;</code></p>
<p><code>width:whatever;<br />
}</code></p>
<p>For good measure, you’ll need to apply the IE fix:<br />
body { text-align:center; }<br />
And yes indeed, the “text-align:left” of the wrapper makes sure the text aligns to the left again.</p>
<p>Now you’re free to absolutely position the content using the wrapper as reference point. This is due to the fact that an element with <strong>position:relative</strong> applied to it forces every element inside it (the so called child element) to use<strong> the parent as reference</strong>, not the viewport (the part of the browser in which a web page is displayed). You could say it resets the reference point of it’s children elements.</p>
<p>This means you can still use absolute positioning while centring the whole page, like so:<br />
<code><br />
.content {<br />
position: absolute;<br />
left: whatever;<br />
top: whatever;</code></p>
<p><code>width: whatever;<br />
}</code></p>
<p>In this specific case, he needed a div to be placed <strong>over</strong> some Flash content. Good news: It works like a charm for positioning something over Flash!</p>
<p>So there you have it, cross browser centring of absolute &amp; relative positioned divs working in modern browsers such as Mozilla Firefox, Opera &amp; Safari as well as the ye olde Internet Explorer. Hope this lil’ article has been useful to you.</p>
<p><a href="http://james.gameover.com/index.php/2005/on-horisontal-css-centering-using-absolute-positioning/" rel="bookmark">On Horizontal CSS Centering using Absolute Positioning or how Relative Positioning can rock your css.</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 2 October 2005.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>84</slash:comments>
		</item>
	</channel>
</rss>
