<?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>Keep The Web Weird - Interface Musings from Buck Wilson &#187; css</title>
	<atom:link href="http://www.keepthewebweird.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.keepthewebweird.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 10 Dec 2008 04:54:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Image overlapping content in a rounded corner layout</title>
		<link>http://www.keepthewebweird.com/image-overlapping-content-in-a-rounded-corner-layout/</link>
		<comments>http://www.keepthewebweird.com/image-overlapping-content-in-a-rounded-corner-layout/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 05:55:15 +0000</pubDate>
		<dc:creator>Buck</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.keepthewebweird.com/?p=12</guid>
		<description><![CDATA[Every now and again, I run into a complex rounded corner layout that requires a bit of finagling with overflows, z-indices and positions. The most common case is that the image I have used for the top corner is overlapping the content within the content div. 
The problem

To see what I mean, check out the [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and again, I run into a complex rounded corner layout that requires a bit of finagling with overflows, z-indices and positions. The most common case is that the image I have used for the top corner is overlapping the content within the content div. </p>
<h2>The problem</h2>
<p>
<a href='http://www.keepthewebweird.com/wp-content/uploads/2008/03/firefox-overflow-hidden.png' title='Image overlaps the content'><img src='http://www.keepthewebweird.com/wp-content/uploads/2008/03/firefox-overflow-hidden.thumbnail.png' alt='Image overlaps the content' class='alignright'/></a>To see what I mean, <a href='/demo/z_index_post/overflow_hidden.html'>check out the demo</a> I put together for illustration purposes. In everything but Firefox 3 beta, the top image overlaps the content within the <code>&lt;div class=&apos;content&apos;&gt;</code> div. This behavior is pictured to the right as well. </p>
<p style='clear: right'>Now your first thought is that this is a z-index issue, and you wouldn&#8217;t be far off (we&#8217;ll get to that in a moment), but the <em>cause</em> of the problem is the overflow: hidden attached to the .cap class. If you ditch this (we&#8217;ll use the utter magic of Firebug to accomplish this)&#8230; <em>voilá</em>, your content is visible. <a href='/demo/z_index_post/overflow_hidden_off.html'>View the previous demo with overflow: hidden removed</a>.</p>
<p><a href='http://www.keepthewebweird.com/wp-content/uploads/2008/03/firefox-overflow-hidden-off.png' title='Overflow hidden is off… your content is visible'><img src='http://www.keepthewebweird.com/wp-content/uploads/2008/03/firefox-overflow-hidden-off.thumbnail.png' alt='Overflow hidden is off… your content is visible' /></a></p>
<h3>Is this a bug? </h3>
<p>I&#8217;m honestly not sure what&#8217;s going on here, from a rendering standpoint. It seems like the negative margin on the .cap div is throwing off the renderer, disallowing content from being shown within the box model; that is, it&#8217;s a rendering bug. Maybe it&#8217;s a commonly known bug? I honestly have no idea; as much development work as I do, you&#8217;d think I&#8217;d keep up with the trends and <a href='http://www.positioniseverything.net/explorer/peekaboo.html'>bugs with their catchy names</a>. If you know of this being a common bug, please let me know! That is&#8230; when I get the comment system up and running.</p>
<p>The thing that makes me wonder if this is a bug is the fact that it happens in all browsers (even the WebKit beta, which seems to be <a href='http://webkit.org/blog/161/webkit-hits-93100-in-acid3/'>at the forefront of CSS compliance</a>). However, it seems to render just fine in the Firefox 3 beta&#8230; so who knows? Not me.</p>
<h2> The Fix </h2>
<p>Now, on to a fix:</p>
<p>The problem for me, is turning off overflow: hidden can sometimes create its own problems. I&#8217;m thinking specifically of IE not adhering to the <code>height:</code> property if the height is smaller than 1em (even if there <i>is no text in the div<i>). In order to fix this, you </i>must</i> use <code>overflow: hidden</code>. It&#8217;s good practice if you want a div to maintain a static height, anyway. So how do we fix this and keep <code>overflow: hidden</code> intact?</p>
<p>Z-index! As far as crazy css properties go, this one is pretty reliable across all browsers. The only thing you have to remember is to <i>make sure you put a <code>position:</code> attribute on the div</i>. Z-index is completely unreliable if there is no <code>position:</code> attribute of the div it applies to. In most cases, <code>position: relative;</code> will do just fine without screwing up your layout. </p>
<p>In this case, I applied a z-index of 10 (anything higher than 1 is not necessary, but going overboard is fun) to the .content div, which effectively puts it on &#8220;top&#8221; of the .cap div. <a href='/demo/z_index_post/z_index.html'>See this fix in action</a>.</p>
<p>I know it&#8217;s not a terribly common bug, and it&#8217;s not a terribly difficult fix to figure out. However, it bugs me every so often, so I thought I&#8217;d share what I&#8217;ve learned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keepthewebweird.com/image-overlapping-content-in-a-rounded-corner-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.374 seconds -->

<!-- Page not cached by WP Super Cache. Could not get mutex lock. -->
