AllExperts > DHTML 
Search      
DHTML
Volunteer
Answers to thousands of questions
 Home · More DHTML Questions · Answer Library  · Encyclopedia ·
More DHTML Answers
Question Library

Ask a question about DHTML
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Andrew Hoffman
Expertise
I can field just about any question within this topic ranging from JavaScript to CSS, the two ingredients of DHTML. I`m very interested in the W3C and its validation rules for HTML, XHTML, and CSS, and enjoy answering questions of this type as well. I detest sleep and respond at all hours of the day or night.


Experience
Experience in the area
I've been working with DHTML and CSS for 7 years now and build/maintain websites of my own that implement DHTML navigation.

What I'm doing now
My contract with Microsoft has ended and I am working for myself once again. Please contact me for any front-end work at antibland@gmail.com

 
   

You are here:  Experts > Computing/Technology > HTML/XML > DHTML > horizontal rule tag causing additional white space

DHTML - horizontal rule tag causing additional white space


Expert: Andrew Hoffman - 5/22/2007

Question
Hello Andrew:
Unfortunately I found out the hard way that <hr> property is interpreted differently by most browsers, especially IE, which creates additional white space below the horizontal line.

I tried defining properties like border, padding, line space, etc., but nothing helps.  

If you want to see what I mean, here is the link to my website, http://lauramohanty.com/Resume.html.  In mozilla it's fine, and I validated the CSS code.  However, I.E., it looks different with the extra spacing.  This minor detail is driving me bonkers!

Have you experienced a problem similar to this before?  Is there something I can try to elimate white space with <HR>,  I really don't want to use any images if possible.

Thanks again for your help!
-Laura


Answer
I've had this happen too, and zeroing out the padding and margins doesn't seem to solve this problem in IE.  What I've done as a workaround is to use a centered div with a fixed height and width.  Copy and paste this chunk to see what I mean (works happily with IE too):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
div.hz_line {
 height: 2px;
 background: #ccc;
 width: 600px;
 text-align: center;
 margin: 0 auto;
}
#container {
  width: 800px;
}
</style>
</head>

<body>
<div id="container">
<p>content here content here content here content here content here content here content here content here content here content here content here content here content here content here</p>
<div class="hz_line"></div>
<p>content here content here content here content here content here content here content here content here content here content here content here content here content here content here</p>
</div>
</body>
</html>


Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.