Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spacing before a HTML Horizontal Line

I was setting up some signatures in HTML which will end up in Outlook. One issue I have is that when inserting a horizontal line, it inserts a large space above and a smaller space below the line. My issue is the very large space above the horizontal line. It's almost the size of a full break

<br>

If I manually edit the signature in Outlook by setting the spacing after the text that is just before the horizontal line it's okay, but I can't do this manually for the # of them I need to edit. Here is an example of my issue:

<html>
<head>
    <title>HTML Online Editor Sample</title>
</head>
<body>
    <p>
        <span style="font-size:12pt;"><span style="font-family: arial, helvetica, sans-serif;"><b>This is a test</b></span></span></p>
    <hr style="height: 2px; width: 99%; background-color: #848484" />
    <p>
        <span style="font-size:10pt;"><span style="font-family: arial, helvetica, sans-serif;"><b>Text under the line</b></span></span></p>
</body>
</html>

Is there a way I can tighten the text before or after the line?

like image 240
Untalented Avatar asked Nov 24 '25 14:11

Untalented


2 Answers

Paragraph elements <p> have some natural padding anad marggin so try to add padding: 0 and margin: 0 to them

like image 171
Michael Tichoň Avatar answered Nov 27 '25 03:11

Michael Tichoň


The hr and p elements have some padding/margins inserted by the by the browser. Add margin: 0; to remove that.

like image 22
Tom Oakley Avatar answered Nov 27 '25 03:11

Tom Oakley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!