Article ID: 883631
You cannot reduce the top margin and the bottom margin of the horizontal rule (HR) tag to nothing by using cascading style sheets (CSS). When the CSS style margin:auto is applied to the HR elements in Microsoft Internet Explorer, the top margin and the bottom margin are maintained. You can see the symptoms of the problem if you put the following sample code in a text file.
Save the text file with either an .htm file name extension or with an .html file name extension. Then, view the file by using Internet Explorer.
The following workarounds use DIV tags instead of HR tags:
Use an HR tag that is contained inside a DIV tag. This provides better backward compatibility with browsers that do not support DIV tags or CSS. This is the recommended workaround.
Use the font-size style to provide the height for the DIV tag.
Use an empty DIV tag inside a styled DIV tag to provide the height for the DIV tag.
The following sample code demonstrates the workarounds:
Note The document type definition (DTD) specification at the beginning of the sample code is required for Internet Explorer to support Workaround 1 and Workaround 3. This is because the border location of the DIV tag is treated differently based on the DTD specification.
For additional information, visit the following Microsoft Developer Network (MSDN) Web sites:
CSS enhancements in Internet Explorer 6
http://msdn2.microsoft.com/en-us/library/bb250395.aspxMargin attribute | Margin property
http://msdn2.microsoft.com/en-us/library/ms534140.aspxHR element | HR object
Article ID: 883631 - Last Review: June 20, 2014 - Revision: 2.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.