如何在不发送垃圾邮件的情况下使用空格<br/>

我有以下代码:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Unified Bank</title>
        <link rel="stylesheet" href="style.css">
        <script src="script.js"></script>
    </head>
    <body>
        <h1>Lorem Ipsum</h1>
        <div id="Lorem">
            <button>Ipsum</button>
            <button>Lorem</button>
        </div>
        <br/>
        <a href="forgot.html">Forgot Password?</a>
    </body>
</html>

I would like to have a lot of space between the <header> and the <button>, however this will require a lot of <br/> tags, as well as making the code a little messy. Is there a different way to do this?

评论
  • Henry
    Henry 回复

    You can do this with the margin attribute in CSS.

    #Lorem {
      margin-bottom: 40px;
    }
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title>Unified Bank</title>
            <link rel="stylesheet" href="style.css">
            <script src="script.js"></script>
        </head>
        <body>
            <h1>Lorem Ipsum</h1>
            <div id="Lorem">
                <button>Ipsum</button>
                <button>Lorem</button>
            </div>
            <br/>
            <a href="forgot.html">Forgot Password?</a>
        </body>
    </html>
  • 零零柒
    零零柒 回复

    You can use the CSS margin property to add space around an element.

    <h1 style="margin-bottom: 100px;">Lorem Ipsum</h1>
    
  • 萌了个兔
    萌了个兔 回复

    不好用

    <pre>
    
    
    ... any white space you need
    </pre>
    

    As good practice - margin/padding or flexbox at your service.