<?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>Autarchy of the Private Cave &#187; margin</title> <atom:link href="https://bogdan.org.ua/tags/margin/feed" rel="self" type="application/rss+xml" /><link>https://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Wed, 28 Dec 2022 16:09:04 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>https://wordpress.org/?v=3.8.27</generator> <item><title>IE (Internet Explorer) margin doubling bug fixes</title><link>https://bogdan.org.ua/2006/09/27/ie-internet-explorer-margin-doubling-bug-fixes.html</link> <comments>https://bogdan.org.ua/2006/09/27/ie-internet-explorer-margin-doubling-bug-fixes.html#comments</comments> <pubDate>Wed, 27 Sep 2006 13:05:23 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[Notepad]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[XHTML/CSS]]></category> <category><![CDATA[bug]]></category> <category><![CDATA[double]]></category> <category><![CDATA[fix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[IE]]></category> <category><![CDATA[margin]]></category> <guid
isPermaLink="false">http://www.bogdan.org.ua/2006/09/27/ie-internet-explorer-margin-doubling-bug-fixes.html</guid> <description><![CDATA[In Internet Explorer for Windows (tested with version 6 SP2), if you write CSS code similar to this: #floatbox &#123; &#160; float: left; &#160; width: 150px; &#160; height: 150px; &#160; margin-left: 100px; &#125; and put your &#8220;floatbox&#8221; inside a container (such as DIV), you will actually see 200px of the left margin instead of the [&#8230;]]]></description> <content:encoded><![CDATA[<p>In Internet Explorer for Windows (tested with version 6 SP2), if you write CSS code similar to this:</p><div
id="ig-sh-1" class="syntax_hilite"><div
class="code"><ol
class="css" style="font-family:monospace;"><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span
style="color: #cc00cc;">#floatbox</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span
style="color: #00AA00;">&#123;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">float</span><span
style="color: #00AA00;">:</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">150px</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">150px</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">margin-left</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">100px</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span
style="color: #00AA00;">&#125;</span></div></li></ol></div></div><p>and put your &#8220;floatbox&#8221; inside a container (such as DIV), you will actually see 200px of the left margin instead of the expected 100px. This problem is known as &#8220;IE margin-doubling bug&#8221;.</p><p>In this post I collected solutions you can use to avoid this problem. The solution I&#8217;d recommend is at the end.<br
/> <span
id="more-40"></span><br
/> The first solution is to apply some minimal height to the container:</p><div
id="ig-sh-2" class="syntax_hilite"><div
class="code"><ol
class="css" style="font-family:monospace;"><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span
style="color: #00AA00;">*</span> html <span
style="color: #6666ff;">.visualIEFloatFix</span> <span
style="color: #00AA00;">&#123;</span> <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">0.01%</span><span
style="color: #00AA00;">;</span> <span
style="color: #00AA00;">&#125;</span></div></li></ol></div></div><p>This method is described in more details <a
href="http://plone.org/documentation/kb/internet-explorer-invisible-text">here</a> , and even better <a
href="http://plone.org/documentation/kb/ie-double-margin-bug">here</a>.</p><p>Another one is to apply position:relative, this is quite an old solution, described <a
href="http://www.communitymx.com/content/article.cfm?cid=C37E0">here</a> (there are also other fixes for the problem there, too; link returned error at the time of writing, might be a temporal problem &#8211; if not, please remind me to remove it).</p><p>Another solution is to wrap the element in another one, and apply float to that another. Removing float from the element helps avoid the trouble. This fix found <a
href="http://www.positioniseverything.net/explorer/floatIndent.html">here</a>. There are lots of examples there, too.</p><p>You can also set display:inline, as described in <a
href="http://www.positioniseverything.net/explorer/doubled-margin.html">this solution</a>. I would recommend using this one as the most clean and compatible. To apply it to our example at the beginning, we should write the following CSS code:</p><div
id="ig-sh-3" class="syntax_hilite"><div
class="code"><ol
class="css" style="font-family:monospace;"><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span
style="color: #6666ff;">.floatbox</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span
style="color: #00AA00;">&#123;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">float</span><span
style="color: #00AA00;">:</span> <span
style="color: #000000; font-weight: bold;">left</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">width</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">150px</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">height</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">150px</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">margin-left</span><span
style="color: #00AA00;">:</span> <span
style="color: #933;">100px</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; <span
style="color: #000000; font-weight: bold;">display</span><span
style="color: #00AA00;">:</span> <span
style="color: #993333;">inline</span><span
style="color: #00AA00;">;</span></div></li><li
style="font-weight: normal; vertical-align:top;"><div
style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span
style="color: #00AA00;">&#125;</span></div></li></ol></div></div><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F27%2Fie-internet-explorer-margin-doubling-bug-fixes.html&amp;linkname=IE%20%28Internet%20Explorer%29%20margin%20doubling%20bug%20fixes" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F27%2Fie-internet-explorer-margin-doubling-bug-fixes.html&amp;linkname=IE%20%28Internet%20Explorer%29%20margin%20doubling%20bug%20fixes" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F27%2Fie-internet-explorer-margin-doubling-bug-fixes.html&amp;linkname=IE%20%28Internet%20Explorer%29%20margin%20doubling%20bug%20fixes" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F27%2Fie-internet-explorer-margin-doubling-bug-fixes.html&amp;linkname=IE%20%28Internet%20Explorer%29%20margin%20doubling%20bug%20fixes" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F27%2Fie-internet-explorer-margin-doubling-bug-fixes.html&amp;linkname=IE%20%28Internet%20Explorer%29%20margin%20doubling%20bug%20fixes" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2006%2F09%2F27%2Fie-internet-explorer-margin-doubling-bug-fixes.html&#038;title=IE%20%28Internet%20Explorer%29%20margin%20doubling%20bug%20fixes" data-a2a-url="https://bogdan.org.ua/2006/09/27/ie-internet-explorer-margin-doubling-bug-fixes.html" data-a2a-title="IE (Internet Explorer) margin doubling bug fixes"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2006/09/27/ie-internet-explorer-margin-doubling-bug-fixes.html/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>