<?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>ejohansson.se &#187; css</title>
	<atom:link href="http://ejohansson.se/tags/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://ejohansson.se</link>
	<description>Random bits about Linux, programming, computers and occasionally other stuff.</description>
	<lastBuildDate>Sun, 18 Apr 2010 20:23:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Highlight linked comment with css and&#160;:target</title>
		<link>http://ejohansson.se/archives/2006/02/14/highlight-linked-comment-with-css-and-target/</link>
		<comments>http://ejohansson.se/archives/2006/02/14/highlight-linked-comment-with-css-and-target/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 00:17:46 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2006/02/14/highlight-linked-comment-with-css-and-target/</guid>
		<description><![CDATA[By using the css pseudo class :target it&#8217;s possible to style an element with the id that&#8217;s given after the # in a url different. This technique is used in the Subversion FAQ where the current question is marked with a red border.
Another good place to use this, is within your blog. By adding the [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_155" class="wp-caption alignright" style="width: 265px"><img src="http://files.ejohansson.se/wp-content/uploads/2008/08/target_pseudo_class.png" alt=":target pseudo class" title=":target pseudo class" width="255" height="117" class="size-full wp-image-155" /><p class="wp-caption-text">:target pseudo class</p></div>
<p>By using the css <a href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#target-pseudo">pseudo class :target</a> it&#8217;s possible to style an element with the id that&#8217;s given after the # in a url different. This technique is used in the <a href="http://subversion.tigris.org/faq.html#why">Subversion FAQ</a> where the current question is marked with a red border.</p>
<p>Another good place to use this, is within your blog. By adding the following three lines to your styles.css your readers will be able to know exactly what comment you (or someone else) are linking to.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">ol<span style="color: #6666ff;">.commentlist</span> li<span style="color: #3333ff;">:target </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>This code will give you the behaviour show in the image. To see the differences live, this link gives you a <a href="http://ejohansson.se/archives/2006/01/27/ibook-linux-wlan/#comment-3">highlighted comment</a> and this gives you the <a href="http://ejohansson.se/archives/2006/01/27/ibook-linux-wlan/#comments">normal colouring</a>.</p>
<p>Unfortunely, as about any other <a href="http://ejohansson.se/archives/2006/02/07/rounded-corners-the-easy-way/">interesting technique</a>, this doesn&#8217;t work in IE. It is of course possible to get a similar effect in IE, but that involves javascript.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2006/02/14/highlight-linked-comment-with-css-and-target/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rounded corners the easy&#160;way</title>
		<link>http://ejohansson.se/archives/2006/02/07/rounded-corners-the-easy-way/</link>
		<comments>http://ejohansson.se/archives/2006/02/07/rounded-corners-the-easy-way/#comments</comments>
		<pubDate>Tue, 07 Feb 2006 00:29:37 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2006/02/07/rounded-corners-the-easy-way/</guid>
		<description><![CDATA[Would you like to have boxes with rounded corners on your site? Would you like them to work without having to specify an absolute size for the boxes? Do you want the quick and easy fix which doesn&#8217;t require a lot of extra &#60;div&#62;? Are you satisfied if the solution works for everybody except the [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_159" class="wp-caption alignright" style="width: 229px"><img src="http://files.ejohansson.se/wp-content/uploads/2008/08/rounded_corners.png" alt="Rounded corners" title="Rounded corners" width="219" height="95" class="size-full wp-image-159" /><p class="wp-caption-text">Rounded corners</p></div>
<p>Would you like to have boxes with rounded corners on your site? Would you like them to work without having to specify an absolute size for the boxes? Do you want the quick and easy fix which doesn&#8217;t require a lot of extra &lt;div&gt;? Are you satisfied if the solution works for everybody except the approximately 85% of internet users which uses a <a href="http://www.microsoft.com/windows/ie/">non-standards compliance browser</a>?</p>
<p>If you answered yes to those questions, you should continue reading.</p>
<p><span id="more-44"></span></p>
<p>First you need to get the images that will act as the corners.</p>
<ul>
<li><a href="http://files.ejohansson.se/wp-content/uploads/2008/08/box_top_left.png">box_top_left.png</a></li>
<li><a href="http://files.ejohansson.se/wp-content/uploads/2008/08/box_top_right.png">box_top_right.png</a></li>
<li><a href="http://files.ejohansson.se/wp-content/uploads/2008/08//box_bottom_left.png">box_bottom_left.png</a></li>
<li><a href="http://files.ejohansson.se/wp-content/uploads/2008/08/box_bottom_right.png">box_bottom_right.png</a></li>
</ul>
<p>If you have a different background color than I do, change all the images to reflect that.</p>
<p>Then, assuming the box that you wish to &#8220;round&#8221; is encapsulated in a &lt;div class=&#8221;sidebarbox&#8221;&gt;, all that you need to add to your css-file is this</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.sidebarbox</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/box_top_right.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">right</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/box_top_left.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.sidebarbox</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/box_bottom_right.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">right</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/box_bottom_left.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>If you are using a standards compliance browser, you should be able to see the result in the sidebar to your right. If you use IE, you have to settle with the image at the start of the post.</p>
<p>If you need it to work in IE as well, there are plenty of solutions on the internet. Use the search box to the right and get funky with it. If you find a good one that doesn&#8217;t require you to specify the absolute size of the boxes, let me know.</p>
<p>More information</p>
<ul>
<li><a href="http://www.w3.org/Style/Examples/007/roundshadow.html">Rounded corners and shadowed boxes</a></li>
<li><a href="http://www.alistapart.com/articles/mountaintop/">A List Apart: Mountaintop Corners</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2006/02/07/rounded-corners-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IE renders better than&#160;Firefox&#8230;or?</title>
		<link>http://ejohansson.se/archives/2006/02/01/ie-renders-better-than-firefoxor/</link>
		<comments>http://ejohansson.se/archives/2006/02/01/ie-renders-better-than-firefoxor/#comments</comments>
		<pubDate>Wed, 01 Feb 2006 11:43:41 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2006/02/01/ie-renders-better-than-firefoxor/</guid>
		<description><![CDATA[I was about to write a post on how Internet Explorer rendered a page in a way that seemed to be more correct than the way Firefox did it. Luckily I did some CSS specification reading first, and thus saved myself the embarrassment of making the controversial statement that IE renders better than Firefox and [...]]]></description>
			<content:encoded><![CDATA[<p>I was about to write a post on how Internet Explorer rendered a page in a way that seemed to be more correct than the way Firefox did it. Luckily I did some <a href="http://www.w3.org/TR/CSS21/">CSS specification</a> reading first, and thus saved myself the embarrassment of making the controversial statement that <em>IE renders better than Firefox</em> and then being wrong.</p>
<p><span id="more-37"></span></p>
<p>But let&#8217;s start with the problem. As seen on my site I have a layout with a wide main column and a thinner sidebar. The layout is (or was, as I redid it to make it look better in IE) made with code similar to the following</p>
<pre>
&lt;html&gt;&lt;head&gt;&lt;title&gt;Test&lt;/title&gt;
&lt;style type="text/css"&gt;
body {
	margin: 0px;
}
.page {
	width: 77%;
	padding: 5em 0em 5em 0em;
	background-color: red;
}
.sidebar {
	width: 21%;
	top: 1%;
	right: 1%;
	position: absolute;
	padding: 2em 0em 2em 0em;
	background-color: blue;
}
&lt;/style&gt;&lt;/head&gt;&lt;body&gt;
&lt;div class="page"&gt;
	&lt;p&gt;Text inside class="page"&lt;/p&gt;
	&lt;div class="sidebar"&gt;
		&lt;p&gt;Text inside class="sidebar"&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;&lt;/html&gt;
</pre>
<p>The behaviour in IE is to render the sidebar with the width calculated using the width of <code>&lt;div class="page"&gt;</code> as reference. This results in an effective width of 21% * 77% = 16%. Firefox on the other hand uses the root element (<code>&lt;body&gt;</code> or one of its ancestors) which has a width of 100%. This gives an effective width of 21% (which is what I intended).</p>
<p>Intuitively IE&#8217;s behaviour seems to be the correct one: the width is calculated using the nearest bounding element (i.e. containing block) as parent. But, as can be seen in <a href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">section 10.1</a> in the CSS specification, there is a special case when using <code>position: absolute</code></p>
<blockquote><p>
If the element has &#8216;position: absolute&#8217;, the containing block is established by the nearest ancestor with a &#8216;position&#8217; of &#8216;absolute&#8217;, &#8216;relative&#8217; or &#8216;fixed&#8217; [...]
</p></blockquote>
<p>Therefore, in this case the containing block should be the root element (or initial containing block as the standard calls it), which is what Firefox uses.</p>
<p>So, too sum up: Firefox and Konqueror follows the specification; IE and Opera (surprisingly) does not.</p>
<p>For the sake of completeness (and not wanting to bash IE and Opera too much), I&#8217;ll better mention this (from the <a href="http://www.w3.org/TR/CSS21/">Abstract</a>)</p>
<blockquote><p>
CSS 2.1 corrects a few errors in CSS2 (the most important being a new definition of the height/width of absolutely positioned elements [...]
</p></blockquote>
<p>So, IE and Opera are proably only adhering to the old <a href="http://www.w3.org/TR/CSS2/">CSS 2 standard</a>, instead of the new revision, <a href="http://www.w3.org/TR/CSS21/">version 2.1</a>.</p>
<p>Once again, open source and its mantra <a href="http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s04.html">release early, release often</a> has proven its superiority!</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2006/02/01/ie-renders-better-than-firefoxor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
