简体   繁体   中英

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?

段落元素<p>有一些自然的填充和边缘,所以尝试添加填充:0和margin:0

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

<hr style="height: 2px; width: 99%; margin:0 auto;line-height:2px;background-color: #848484"; border:0 none; />

OR

<hr style="height: 0; width: 99%; line-height:0;border-bottom:2px solid #848484; background:none;" />

fiddled here

Always good to start with a reset CSS and take it from there.

Useful link: http://meyerweb.com/eric/tools/css/reset/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM