<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: &lt;hr&gt; element css &#8211; removing the gaps in IE6 and IE7</title>
	<atom:link href="http://www.simonbattersby.com/blog/hr-element-css-removing-the-gaps-in-ie/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.simonbattersby.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 17:49:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: twohawks</title>
		<link>http://www.simonbattersby.com/blog/hr-element-css-removing-the-gaps-in-ie/#comment-5228</link>
		<dc:creator>twohawks</dc:creator>
		<pubDate>Sat, 27 Aug 2011 02:09:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonbattersby.com/blog/?page_id=662#comment-5228</guid>
		<description>I bet this is old, but I stumbled here while trying to harness this particular problem. Thank you for posting it.
  Here&#039;s what I found... 
conventionally I see folks using font-size and line-height reduciton, along with, perhaps, overflow:hidden, in order to control the margins issue relevant here.  To note, IE ascribes a default line-height to an element, so say you try to place an hr in a div... the div will not collapse all the way.

To make matters worse, if you use any of the conventional methods for dealing with it, and then presume to add a background color to the hr, the hr will force a line-height... one that you cannot counter with line-height, font-size or height or margins methods, and if you use the overflow:huidden method it will simply disappear!

The solution I found that works across all browsers, period, is to use position:absolute !  Here&#039;s an example...

&lt;pre&gt;&lt;div style=”Position:relative; border: 1px solid red; margin: 5px auto;”&gt;
&lt;hr style=”position:absolute; border-width: 0pt; margin: 0px auto; height: 2px; width: 80%; left:10%; color: khaki; background-color: khaki;”/&gt;
&lt;/div&gt;&lt;/pre&gt;
	
The div border is there so you can see it, set it to 0 to turn it off.
If you have a parent or css passing height to the div, reset the height (to something small).
Use the div margin attributes to adjust vertical spacing.
Use left and width attributes in the HR to center it horizontally.
Using the css in this manner also allows consistent hr coloring across all browsers.  

Things I had to use before, but with less than perfect results were..
in the div: height margin font-size line-height text-align:center align-center

I was able to get rid of all that. 
Works in IE6-8 (did not test 9, but I bet its fine), FF3-4, Opera 9-10, Chrome X-X, Safari 3-5... and I bet others ;^)

cheers, twohawks</description>
		<content:encoded><![CDATA[<p>I bet this is old, but I stumbled here while trying to harness this particular problem. Thank you for posting it.<br />
  Here&#8217;s what I found&#8230;<br />
conventionally I see folks using font-size and line-height reduciton, along with, perhaps, overflow:hidden, in order to control the margins issue relevant here.  To note, IE ascribes a default line-height to an element, so say you try to place an hr in a div&#8230; the div will not collapse all the way.</p>
<p>To make matters worse, if you use any of the conventional methods for dealing with it, and then presume to add a background color to the hr, the hr will force a line-height&#8230; one that you cannot counter with line-height, font-size or height or margins methods, and if you use the overflow:huidden method it will simply disappear!</p>
<p>The solution I found that works across all browsers, period, is to use position:absolute !  Here&#8217;s an example&#8230;</p>
<pre>&lt;div style=”Position:relative; border: 1px solid red; margin: 5px auto;”&gt;
&lt;hr style=”position:absolute; border-width: 0pt; margin: 0px auto; height: 2px; width: 80%; left:10%; color: khaki; background-color: khaki;”/&gt;
&lt;/div&gt;</pre>
<p>The div border is there so you can see it, set it to 0 to turn it off.<br />
If you have a parent or css passing height to the div, reset the height (to something small).<br />
Use the div margin attributes to adjust vertical spacing.<br />
Use left and width attributes in the HR to center it horizontally.<br />
Using the css in this manner also allows consistent hr coloring across all browsers.  </p>
<p>Things I had to use before, but with less than perfect results were..<br />
in the div: height margin font-size line-height text-align:center align-center</p>
<p>I was able to get rid of all that.<br />
Works in IE6-8 (did not test 9, but I bet its fine), FF3-4, Opera 9-10, Chrome X-X, Safari 3-5&#8230; and I bet others ;^)</p>
<p>cheers, twohawks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

